3

你如何重试Laravel Horizo​​n 中所有失败的工作?似乎没有“全部重试”按钮,并且由于失败的作业未存储在表中,因此 artisan 命令不起作用。

4

2 回答 2

3

queue:retry命令接受all代替单个作业 ID:

php artisan queue:retry all

这会将所有失败的作业推回您的 redis 队列以重试:

The failed job [44] has been pushed back onto the queue!
The failed job [43] has been pushed back onto the queue!
...

如果您没有根据安装指南创建失败的日志表:

php artisan queue:failed-table
php artisan migrate

那么你可能会上一条小溪。也许尝试手动与 redis 交互并尝试直接访问失败的作业列表(假设失败的作业条目没有被擦除 - 看起来他们默认在 redis 中保留一周,基于 config 中的设置config/horizon.php)。

于 2020-02-06T22:42:23.337 回答
2

as the failed jobs aren't stored in a table

Actually, you should create that table. From the Laravel Horizon documentation:

You should also create the failed_jobs table which Laravel will use to store any failed queue jobs:

php artisan queue:failed-table

php artisan migrate

Then, to retry failed jobs:

Retrying Failed Jobs

To view all of your failed jobs that have been inserted into your failed_jobs database table, you may use the queue:failed Artisan command:

php artisan queue:failed

The queue:failed command will list the job ID, connection, queue, and failure time. The job ID may be used to retry the failed job. For instance, to retry a failed job that has an ID of 5, issue the following command:

php artisan queue:retry 5
于 2019-08-20T18:55:12.777 回答