post_put_hooks and tasklets

24 views
Skip to first unread message

Doland

unread,
Mar 13, 2013, 4:27:35 PM3/13/13
to appengine-...@googlegroups.com

I have an application that makes extensive use of tasklets and I am starting to implement a few _post_put_hooks now. The hooks may call methods that are implemented as tasklets. My question is how to structure the hooks:

1 can i decorate the hooks with @ndb.tasklet and inside the hooks yield for any calls to other tasklets or async rpc's?
2 or similarly use future waits on tasklet calls within the hook but not use the decorator for the hook method?
3 or should I avoid all async calls from the hook methods?

I ask because my requests complete without waiting for async work done in the hook methods (since i'm not calling the hook myself, i don't know how to wait on its future). One way that I've found to solve this is by decorating all my requests with @ndb.toplevel which may be the only solution. since i also use @ndb.synctasklet i would end up with multiple decorators.
Reply all
Reply to author
Forward
0 new messages