我使用AWS Beanstealk php worker环境。
我在cron.yaml管理我的cron工作
version: 1
cron:
- name: "prepare-technical"
url: "/workers/cron/event/prepare/technical"
schedule: "45 0 * * *"
我并不明白为什么,但是,这个cron执行了两次并且在不同的时间内执行:
127.0.0.1 (-) - - [24/Mar/2017:00:44:59 +0000] "POST /workers/cron/event/prepare/technical HTTP/1.1" 200 - "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [24/Mar/2017:00:52:43 +0000] "POST /workers/cron/event/prepare/technical HTTP/1.1" 200 - "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [25/Mar/2017:00:44:59 +0000] "POST /workers/cron/event/prepare/technical HTTP/1.1" 200 - "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [25/Mar/2017:00:49:59 +0000] "POST /workers/cron/event/prepare/technical HTTP/1.1" 200 - "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [26/Mar/2017:00:44:59 +0000] "POST /workers/cron/event/prepare/technical HTTP/1.1" 200 - "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [26/Mar/2017:00:53:23 +0000] "POST /workers/cron/event/prepare/technical HTTP/1.1" 200 - "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [27/Mar/2017:00:44:59 +0000] "POST /workers/cron/event/prepare/technical HTTP/1.1" 200 - "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [27/Mar/2017:00:50:35 +0000] "POST /workers/cron/event/prepare/technical HTTP/1.1" 200 - "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [28/Mar/2017:00:45:00 +0000] "POST /workers/cron/event/prepare/technical HTTP/1.1" 200 - "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [28/Mar/2017:00:50:00 +0000] "POST /workers/cron/event/prepare/technical HTTP/1.1" 200 - "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [29/Mar/2017:00:44:59 +0000] "POST /workers/cron/event/prepare/technical HTTP/1.1" 200 - "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [29/Mar/2017:00:50:16 +0000] "POST /workers/cron/event/prepare/technical HTTP/1.1" 200 - "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [30/Mar/2017:00:45:00 +0000] "POST /workers/cron/event/prepare/technical HTTP/1.1" 200 - "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [30/Mar/2017:00:50:21 +0000] "POST /workers/cron/event/prepare/technical HTTP/1.1" 200 - "-" "aws-sqsd/2.3"
你知道我该如何解决这个问题? 感谢
答案 0 :(得分:0)
默认情况下,如果您的网络服务器在五分钟内没有响应,则会重新发布作业。有几种可能的方法:
1)增加Configuration / Worker Configuration / Advanced Options下的“Inactivity Timeout”。最大值为1800(30分钟)。
2)通过添加处理能力或将它们分成更小的块来使作业更快地运行。
3)当你收到一份工作时,在后台线程中执行它并立即从主线程返回。