Reputation: 1211
My google app engine app sometimes throws deadline exceeded errors when processing a form submit due to an extremely chatty back and forth with a filemaker database backend which winds up taking longer than the 1 minute maximum.
I figure I could improve this by using an appengine task to process the data POSTed from the form, and instead immediately render a response page such as "Your order is being processed, please wait."
Is there a way to determine when the app engine task has completed on the browser/client side so I can render a "Success" page when the order completes? What would be the best way to do this?
Upvotes: 0
Views: 215
Reputation: 8816
There are a few approaches that you can address this with:
Task Queue has a REST API that you could use to get the status of the Task. Keep in mind that this is an experimental API.
When your task is completed, you can update a Datastore entity that contains your Task Details. You can expose a Task Status Web Service (write your own Web Service or better still use Google Cloud Endpoints for that). In your web page, you can poll the status with a Timer Task and update the status as needed.
App Engine also supports the Channel API, which is a nice way to push notifications to the browser in case there is a server side update. So, if you do not want to poll regularly and find that wasteful, especially if there are a lot of users, you could look at the Channel API.
Upvotes: 2
Reputation: 16825
Use the JSON/REST taskqueue. For the other queues you will find trouble.
GET /project/taskqueues/taskqueue/tasks/task Gets the named task in a TaskQueue.
Set a task name and then poll the queue to see if the task is done etc etc and do that with ajax on the client side.
You might also be interested in the pipeline api
Upvotes: 0