Jeff, Retry if err == ErrConcurrentTransaction.
Peter On Saturday, December 26, 2020 at 10:54:36 PM UTC-5 Jeff wrote: > I was curious how datastore.RunInTransaction was implemented in comparison > to the Transaction method set so I took quick look at the source code. > However, I hope I am simply misunderstanding the source code for > datastore.RunInTransaction at: > > > https://github.com/googleapis/google-cloud-go/blob/datastore/v1.3.0/datastore/transaction.go#L161 > > I "think" I understand what it is supposed to do. In short, if the > transaction fails it should retry a number of times. But, when looking at > the code, it appears to return after the first error and only succeed if it > runs successfully through the for loop the number of times. Thus, > increasing the attempts would actually decrease the chances of successfully > committing the transaction as it would need to be successful for each > attempt. > > Hopefully, my interpretation is wrong and someone can explain what is > actually going on. > > Thanks, > Jeff > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/d040b7b5-cc39-4d83-9aed-7926d10b966dn%40googlegroups.com.