升级到Laravel 5.4后,排队的Laravel排队作业运行两次 [英] Queued Laravel queued job runs twice after upgrading to Laravel 5.4

查看:90
本文介绍了升级到Laravel 5.4后,排队的Laravel排队作业运行两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们曾经运行过Laravel 5.2,并且对于我们的一项处理任务,我们将运行控制台命令以将作业排队到Redis队列中.在Laravel 5.4升级之前,此作业将排队,并由队列守护程序拾取,并且只能运行一次.但是,升级后,该作业将被拾取两次,相隔大约1分钟. devop的变化为零,因此我试图弄清楚Laravel所做的不同.我还可以验证console命令仅将作业排队一次,因此守护程序的运行方式有所更改.有没有其他人看到过这样的行为?

We used to run Laravel 5.2, and for one of our processing tasks, we'd run a console command to queue up a job into a Redis queue. Prior to the Laravel 5.4 upgrade, this job would queue up and would get picked up by a queue daemon and would only run once. After the upgrade, however, the job gets picked up twice, about 1 minute apart. There have been zero devops changes so I am trying to figure out what Laravel is doing differently. I can also verify that the console command only queues up the job once, so there is something that has changed with how the daemons are running. Has anyone else seen behavior like this?

推荐答案

今天就读一下.不知道是否有帮助.

Just read this today. Don't know if it will help help.

从文档中

-timeout值应至少比您的
短几秒钟 retry_after配置值.这将确保工人处理 给定的工作总是在重试该工作之前被杀死.如果您的--timeout选项是 超过您的retry_after配置值,可能会处理您的作业 两次.

"The --timeout value should always be at least several seconds shorter than your
retry_after configuration value. This will ensure that a worker processing a given job is always killed before the job is retried. If your --timeout option is longer than your retry_after configuration value, your jobs may be processed twice."

https://laravel.com/docs/5.6/queues#队列工人和部署

这篇关于升级到Laravel 5.4后,排队的Laravel排队作业运行两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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