我有一个 Elastic Beanstalk 工作程序,每次只能运行一个任务,并且完成一个任务需要一些时间(从几分钟到希望少于 30 分钟),因此我将我的任务排队在 SQS 上。
在我的工作程序配置中,我有:
HTTP connections: 1
Visibility timeout: 3600
Error visibility timeout: 300
(On "Advanced")
Inactivity timeout: 1800
问题在于似乎存在一个1分钟超时(在nginx上?),它覆盖了“不活动超时”,导致返回504(网关超时)。
这是我在aws-sqsd.log文件中找到的内容:
2016-02-03T16:16:27Z init: initializing aws-sqsd 2.0 (2015-02-18)
2016-02-03T16:16:27Z start: polling https://sqs.eu-central-1.amazonaws.com/855381918026/jitt-publisher-queue
2016-02-03T16:23:36Z message: sent to %[http://localhost:80]
2016-02-03T16:24:36Z http-err: 1444d1ba-ecb5-46f8-82d6-d0bf19b91fad (1) 504 - 60.006
2016-02-03T16:28:54Z message: sent to %[http://localhost:80]
2016-02-03T16:29:54Z http-err: 1b7514d3-689a-4e8b-a569-5ef1ac32ed0c (1) 504 - 60.029
2016-02-03T16:29:54Z message: sent to %[http://localhost:80]
2016-02-03T16:29:54Z http-err: 1444d1ba-ecb5-46f8-82d6-d0bf19b91fad (2) 500 - 0.006
2016-02-03T16:33:49Z message: sent to %[http://localhost:80]
2016-02-03T16:34:49Z http-err: 3a43e80f-a8d3-46b2-b2a0-9d898ad4f2a6 (1) 504 - 60.023
2016-02-03T16:34:54Z message: sent to %[http://localhost:80]
2016-02-03T16:34:54Z http-err: 1b7514d3-689a-4e8b-a569-5ef1ac32ed0c (2) 500 - 0.004
2016-02-03T16:34:54Z message: sent to %[http://localhost:80]
2016-02-03T16:34:54Z http-err: 1444d1ba-ecb5-46f8-82d6-d0bf19b91fad (3) 500 - 0.003
2016-02-03T16:39:49Z message: sent to %[http://localhost:80]
2016-02-03T16:40:49Z http-err: 3a43e80f-a8d3-46b2-b2a0-9d898ad4f2a6 (2) 504 - 60.019
一些事情在这里是有意义的,比如每条消息从504/500开始到任务再次发送给工作程序员之前需要5分钟的延迟(这与“错误可见超时”的300秒配置相匹配)。
这些500代码符合我的当前逻辑:如果还有什么东西在运行,工作程序员通过抛出500来拒绝任务。
我看到很多答案都谈到了设置负载均衡器连接超时设置,但是,由于这是一个从SQS队列中拉取消息的工作程序员,所以没有负载均衡器。
您有什么想法可以覆盖那个1分钟的超时设置吗?