- class ConcurrencyManager(*args, **kwargs)¶
A class designed to work around database concurrency issues.
A wrapper around get_or_create that makes a final attempt to get the object if the creation fails.
This helps with race conditions in the database where, between the original get() and the create(), another process created the object, causing us to fail. We’ll then execute a get().
This is still prone to race conditions, but they’re even more rare. A delete() would have to happen before the unexpected create() but before the get().