Hi everyone,
I'm new to python, appengine and this group so please bear with me :)
I have a function that updates a set of entities from different entity groups. The set's size will get bigger than the allowed size of cross-group transactions. The issue is, this function may get called from within an existing transaction.
Now the actual task of the function is not important to the running transaction, and so it should be executed outside of it. What's the best way to accomplish such a thing without restructuring the existing code?
My current solution (which is quite bad IMO) is to run the worker function as a tasklet, then wrap it in an outer function that blocks on the tasklet's result. Something like the following (typed in mail):
@ndb.tasklet
def worker_func():
# do some work
raise ndb.Return(True)
def wrapper():
assert worker_func() == True
Thanks,
Ofri