On Wed, Jul 14, 2010 at 3:54 PM, Sam <couponsys...@gmail.com> wrote:

> I believe all that it would do is
> move the timing issue from the main program logic to a defined
> transaction and we would still have the potential gap in time between
> when the initial query was executed to fetch the data and the put()
> was execute to write it back.
>

If the data fetched by the get() at the first of the transaction has been
changed (by another process) when you do the put() at the end of the
transaction, then the transaction will be retried and it will do a new get
which will see the other process's changes and the process repeats.  This
isn't obvious, but it is talked about in one of the links I sent earlier.

I think Robert's example is missing a put() at the end of the transaction
function:

def txn():
    ccode = CCode.all().filter('Assinged', 0)\
                   .filter('ExpireDate >=', dtCompareDate)\
                    .filter("PartnerID", intPartnerID).get()
   if not ccode:
      # handle no ccode....
   ccode.SessionID = strSessionID
   ccode.Assigned = 1
*   ccode.put()
*
 db.run_in_transaction(txn)


-Chris

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to