如何删除所有排队的作业,因为它会导致错误?

2024-03-12

我的网站将电子邮件发送作业排队到jobs桌子。我认为电子邮件服务器有问题,无法发送电子邮件,因此作业被困在作业表中。现在可能有太多作业,我收到此错误消息:

Next exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1 (SQL: update `jobs` set `reserved_at` = 1510263884, `attempts` = 256 where `id` = 342)' in /var/www/vhosts/parcgilley.com/httpdocs/vendor/laravel/framework/src/Illuminate/Database/Connection.php:647
#0 /var/www/vhosts/parcgilley.com/httpdocs/vendor/laravel/framework/src/Illuminate/Database/Connection.php(607): Illuminate\Database\Connection->runQueryCallback('update `jobs` s...', Array, Object(Closure))
#1 /var/www/vhosts/parcgilley.com/httpdocs/vendor/laravel/framework/src/Illuminate/Database/Connection.php(477): Illuminate\Database\Connection->run('update `jobs` s...', Array, Object(Closure))
#2 /var/www/vhosts/parcgilley.com/httpdocs/vendor/laravel/framework/src/Illuminate/Database/Connection.php(416): Illuminate\Database\Connection->affectingStatement('update `jobs` s...', Array)

所以我想知道如何刷新所有排队的作业以清除表?我无法访问数据库来删除表中的数据,那么是否有命令行可以执行此操作?我没有失败的队列表。


假设您正在使用数据库驱动程序,您可以使用:

DB::table('jobs')->delete();

删除所有作业。

另一件事是您应该始终运行设置了尝试的队列工作程序:

php artisan queue:work --tries=3

另请记住,每当您更改应用程序代码时,都应该重新启动工作线程:

php artisan queue:restart

(我假设您使用将再次启动工作人员的主管)。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何删除所有排队的作业,因为它会导致错误? 的相关文章

随机推荐