Laravel 5.5:主管没有 运行 队列中的所有任务

Laravel 5.5: Supervisor Does Not Run All Tasks In Queue

这真的很奇怪。

我的程序将调度一个 QuoteCommitSavedListener 作业,该作业将触发两个 QuoteCommitNotification 作业。 (这两个job都实现了ShouldQueue接口。)

当我运行这个命令在shell

php /home/nginx/test/artisan queue:work redis --queue=default --tries=3

显示如下。太好了。

[2018-04-04 07:25:17] Processing: App\Listeners\QuoteCommitSavedListener
[2018-04-04 07:25:18] Processed:  App\Listeners\QuoteCommitSavedListener
[2018-04-04 07:25:18] Processing: App\Notifications\QuoteCommitNotification
[2018-04-04 07:25:22] Processed:  App\Notifications\QuoteCommitNotification
[2018-04-04 07:25:22] Processing: App\Notifications\QuoteCommitNotification
[2018-04-04 07:25:26] Processed:  App\Notifications\QuoteCommitNotification

有一个 QuoteCommitSavedListener 作业和两个 QuoteCommitNotification 作业。

但是当我运行 supervisor 排队时,它会显示

[2018-04-04 07:30:43] Processing: App\Listeners\QuoteCommitSavedListener
[2018-04-04 07:30:43] Processed:  App\Listeners\QuoteCommitSavedListener
[2018-04-04 07:30:43] Processing: App\Notifications\QuoteCommitNotification
[2018-04-04 07:30:48] Processed:  App\Notifications\QuoteCommitNotification

我不知道为什么第二个 QuoteCommitNotification 作业消失了。

这是我的主管配置

[program:test-queue]
command=php /home/nginx/test/artisan queue:work redis --queue=default --tries=3
autostart=true
autorestart=true
numprocs=1
redirect_stderr=true
stdout_logfile=/home/nginx/test/storage/logs/queue-default.log

问题是两个 laravel 应用程序共享同一个 redis 数据库。改个配置解决这个问题。