【发布时间】:2015-10-05 16:47:16
【问题描述】:
我浏览了这里的文档: https://cloud.google.com/appengine/docs/python/urlfetch/ 和这里: https://cloud.google.com/appengine/articles/deadlineexceedederrors?hl=en
我还发现了这个与我的问题有关的堆栈溢出问题: How to set timeout for urlfetch in Google App Engine?
我正在从我的应用引擎应用程序连接到我无法控制的外部 Web 服务。有时请求需要超过 60 秒。我将我的应用程序设置为使用延迟的应用程序引擎任务队列 api。
我很困惑。在我读过的文档中,似乎 urlfetch 的最大截止日期为 60 秒。但是如果它在 task_queue 中运行是 10 分钟?我真的只需要有人为我澄清这一点。
这是否意味着任务有 10 分钟才能完成,但任务内部的 urlfetch 仍然限制在 60 秒?
伪代码:
myTask = newTask()
deffered.defer(myTask.long_process, _queue="myqueue")
class newTask:
url = "https://example.com"
def long_process(self):
#will setting the deadline to more than 60 seconds work or not?
urlfetch.set_default_fetch_deadline(120)
data = {}
resp = urlfetch.fetch(self.url, method="POST", payload=data)
#do something with resp....
【问题讨论】:
标签: python google-app-engine task-queue urlfetch