Google App Engine Task Queue: DeadlineExceededErro

2019-07-22 05:59发布

问题:

I have a large file I'm uploading. The entire request can take more than the 30 second limit, so I moved it to a task queue. The problem is that I'm still getting this error, even in a task.
I'm assuming this is because it's a single request to upload a file, and is not immune to the 30-second limit because of this. Is there any way to circumvent this limit, aside from using a 'backend' solution (App engine just added this I think, but it's a pay feature and looks a bit complicated)? I can't split up the file, unfortunately.

EDIT: Sorry for the confusion. By uploading, I mean uploading to a foreign server. The scenario is that I'm pulling data from the data store and uploading it to Google Docs Spreadsheets. The single request to upload it to Google Docs, even though it's in the Task Queue, is exceeding 30 seconds and timing out.

回答1:

There are two types of DeadlineExceeded you could be getting - one is due to the request timing out, and the other is due to the URLFetch call timing out. Request deadlines on the task queue are 10 minutes, but the default deadline for a URLFetch call is 5 seconds, so you're almost certainly getting the latter.

You can increase the deadline of your URLFetch call by supplying the timeout parameter. This is limited to 10 seconds in an interactive request, and 10 minutes in a task queue request.



回答2:

Aside the request time limit, there's also a request size limit of 32Mb. If you are you exceeding this, you must use an alternative solution, like Blobstore or external storage.