As far as I can see, there's nothing in the django database doco about transaction failure due to deadlock detection in a multi-user environment. Does this mean that django retries transactions itself a number of times e.g., as google appengine does? I'm pretty sure this would have been mentioned if such were the case.
-- Alternatively, it's up to the programmer to handle deadlocks in code, e.g., by the following method that handles OperationalError exception:
except OperationalError as e:
code = e.args[0]
if attempts == 2 or code != 1213:
raise e
attempts += 1
time.sleep(0.2)
The above assumes the transaction is executed in a loop for retries to occur.
Is this the way to do it?
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b4c50b14-535b-4dc0-92ca-3f65911f7a91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment