我目前在我的 Homestead VM 上使用 Redis 运行 Horizon。
我有一个可排队邮寄的示例,看起来有点像这样:
<?php
namespace App\Mail;
// ... imports ...
class WelcomeEmail extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
public function build()
{
sleep(10);
throw new \Exception("TEST JOB FAILED!");
}
}
我正在使用此处所述的主管配置成功运行 Horizion:https ://laravel.com/docs/5.6/horizon#deploying-horizon
[program:horizon]
process_name=%(program_name)s
command=php /home/ubuntu/code/myapp/artisan horizon
autostart=true
autorestart=true
user=vagrant
redirect_stderr=true
stdout_logfile=/home/ubuntu/code/myapp/storage/horizon.log
像这样运行上面的可邮寄邮件时:
new WelcomeMail();
一个新的作业被创建,并在大约 10 秒后按预期失败。
我的问题是 Horizon 似乎没有重试失败的工作。默认情况下,它应该在 90 秒后(根据config/queue.php
)重试 3 次(根据config/horizon.php
)。
那么为什么我失败的工作没有重试呢?