Kyle
Kyle

Reputation: 22055

Google App Engine - What exception does Transaction.commit() throw when there is a concurrency problem?

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.

Upvotes: 1

Views: 268

Answers (1)

Nick Johnson
Nick Johnson

Reputation: 101149

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.

Upvotes: 2

Related Questions