Google App Engine任务队列:文件上传时出现DeadlineExceededError [英] Google App Engine Task Queue: DeadlineExceededError on file upload

查看:88
本文介绍了Google App Engine任务队列:文件上传时出现DeadlineExceededError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要上传的文件很大.整个请求可能需要超过30秒的限制,因此我将其移至任务队列.问题是,即使在任务中,我仍然遇到此错误.
我假设这是因为这是上传文件的单个请求,因此不能不受30秒限制的影响.除了使用后端"解决方案(我认为App引擎刚刚添加了此功能,但这是一项付费功能,看起来有点复杂)之外,还有什么方法可以规避此限制?不幸的是,我无法拆分文件.

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.

很抱歉造成混乱.通过上传,我的意思是上传到外部服务器.场景是我要从数据存储中提取数据,并将其上传到Google Docs Spreadsheets.将其上传到Google文档的单个请求(即使它在任务队列中)也超过了30秒,并且超时.

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.

推荐答案

您可能会获得两种类型的DeadlineExceeded-一种是由于请求超时,另一种是由于URLFetch调用超时.任务队列上的请求截止时间为10分钟,但URLFetch调用的默认截止时间为5秒,因此几乎可以肯定是后者.

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.

您可以通过提供timeout参数来延长URLFetch调用的期限.在交互式请求中,该时间限制为10秒,在任务队列请求中,该时间限制为10分钟.

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.

这篇关于Google App Engine任务队列:文件上传时出现DeadlineExceededError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆