views:

21

answers:

1

What exception does com.google.appengine.api.datastore.Transaction.commit() throw when there is a concurrency problem?

I want to retry if there is a concurrency issue, but I don't know what exception to catch.

+2  A: 

As per the docs, it raises a TransactionFailedError. Retrying is a bad idea, though: The error gets thrown when there's too much contention, and retrying will simply increase the contention. If you want to change the number of retries, use run_in_transaction_custom_retries, documented here.

Nick Johnson