python - Doing something *after* handling a request in Google App Engine -
i gae else once app has sent response.
the handler this:
class foohandler(webapp.requesthandler): def post(self): self.response.out.write('bar') send_response() # need help! do_something_else() # @ point, response should have been sent
in case wonder why try this:
i need thread-like behaviour, not allowed gae's sandboxed environment. so, function sends several requests whithout caring response. each request starts time-consuming operation (fetching resources) , saves result datastore, can used first function.
note: request handler has send response. if not provide any, wait post function complete , return default headers (which not behaviour i'm looking for, of course)
if can help, solution might use custom wsgi middeleware, have no idea how works (yet)...
as mentioned, can use task queues or deferred api. option outlined rafe kaplan towards end of section in this talk here: can asynchronous api call result hook function process result, , result hook called when call finishes, after response returned user!
Comments
Post a Comment