Threads or background processes in Google App Engine (GAE)
I'm running a post, and need the request to be replied fast. So I wanted to put a worker running some operations开发者_StackOverflow社区 in background and reply the request imidiatly.
The worker is always finite in operations and executes in [0;1] second
How can I do this? Is there any module that suports this in the google app engine api?
Edit:
In python
Yes. You want to use the Task Queue API. It does exactly what you need.
There is now threading support for python 2.7.
https://developers.google.com/appengine/docs/python/backends/overview#background_threads
If you want a long-running worker thread, it will have to live in a backend, but if you want a thread for the lifetime of the request to asynchronize your operations and boost speed, you can now use real threads (just beware that frontend threads are killed when the http request is over).
精彩评论