Jeff, In my case I was not catching any exceptions. Exceptions are not a problem because transaction is not committed in those cases. Problem is sometimes tasks run twice. Since I ran transactional code in those tasks, that code must be idempotant...Task scheduler "should not" re-run tasks which have executed but it does do that on occasion.
On Wed, Sep 21, 2011 at 5:06 PM, Jeff Schnitzer <[email protected]> wrote: > This isn't quite right. Tasks need to be idempotent because execution > is "at least once". Transactions only need to be idempotent if you > write code that retries them when you shouldn't (ie, unknown errors). > > Retrying transactions on ConcurrentModificationException (or any other > known rollback scenario) is appropriate. Retrying other exceptions is > risky business. > > Jeff > > On Wed, Sep 21, 2011 at 3:08 PM, vlad <[email protected]> wrote: > > " that a transaction can complete successfully and the API still returns > an > > error." - yes, it is a bitch. I suffered form this for a long time. > Finally > > I understood that all tasks and especially transactional tasks MUST be > > completely idempotant. GAE docs do not stress that enough but that is > > mandatory. Otherwise you fall into a trap you just described. > > How to achieve idempontency is app specific. For example I use TaskId > > extensively as a entity key to create/update. That way I am guaranteed > that > > double execution will update the same entity. > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google App Engine" group. > > To view this discussion on the web visit > > https://groups.google.com/d/msg/google-appengine/-/XjZZzB7n300J. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > > http://groups.google.com/group/google-appengine?hl=en. > > > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
