Expecting Concurrency Exceptions

42 Views Asked by At

Is it bad practice to expect to always have concurrency exceptions and to just keep retrying? I don't mean in the rare circumstances when two users might edit data at the same time, I mean where it is guaranteed to happen ALL the time time. For example

A league is an aggregate root, which has league matches. When a match is complete an event is raised for that match and the league will update its standings. Most matches are played at the same time, so imagine 4 played at the same time, resulting in 4 events to be raised at the same time "MatchPlayedEvent" We then have the following handler called for the same league 4 times at the exact same time

  • UpdateLeagueStandings
  • UpdateLeagueStandings
  • UpdateLeagueStandings
  • UpdateLeagueStandings

This always throws concurrency exceptions and then will retry.

So again, is it bad to always have this, accept it and to just keep retrying if we get concurrency exceptions?

0

There are 0 best solutions below