Add optional retry parameter to transactions if failure #113

Open
codeconsole opened this Issue Feb 14, 2012 · 1 comment

Comments

Projects
None yet
2 participants
Contributor

codeconsole commented Feb 14, 2012

http://code.google.com/appengine/docs/java/datastore/transactions.html#Uses_for_Transactions

In case of certain exceptions (ConcurrentModificationException, APIDeadlineExceeded, etc), should be able to retry.

e.g.

datastore.withTransaction {
    def e = datastore.get('User', 1234)
    e.lastLogin = new Date()
    e.save()
}, 3

would retry the above transaction 3 times.

Contributor

glaforge commented Feb 14, 2012

In terms of signature, I'd go with something like:

datastore.withTransaction(retry: 3) { ... }

It feels a bit more natural to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment