When using Google App Engine ndb
, do I have to worry about mixing synchronous and asynchronous put operations in the same function?
e.g. Say that I have some code like this:
class Entity(ndb.Model):
some_flag = ndb.BooleanProperty()
def set_flag():
ent=Entity()
ent.some_flag = False
ent.put_async()
ent.some_flag = True
ent.put()
Does that datastore take care of ensuring that all pending async writes are applied before the synchronous write (so that after set_flag
runs, it is guaranteed that the flag will be True
)? Or is there a race condition because the async put might complete after the synchronous put?