I'm developing a GAE application using python and i want it to serve requests concurrently. For this effect I have set threadsafe to true. I have defined two methods in my request handler:
POST - which enqueues a pull task to execute asynchronously, which will later itself enqueue a pull task as a response:
def post(self):
message = self.request.body
taskqueue.add(url='/process', params={'message': message}) #this task will enqueue a pull task as a response
GET - polls the pull task queue for the response until there's one available (I know I should find a way to improve that loop, but I'm just trying it out):
def get(self):
(...)
tasks = queue.lease_tasks_by_tag(1, 100, tag)
while tasks.__len__() == 0:
time.sleep(1)
tasks = queue.lease_tasks_by_tag(1, 100, tag)
The client application calls POST and then GET. I put a breakpoint on the task that is enqueued by the POST method, but it's never called while there's a request handler stuck in the loop. I thought the application was supposed to have several threads serve the requests, so how come it is not executing the push request handler concurrently? I'd appreciate any help with this.