队列任务执行了,但是被标识为执行失败,大佬们看看咋回事
1. 运行环境
centos 7.9
1). 当前使用的 Laravel 版本?
10.48.10
2). 当前使用的 php/php-fpm 版本?
PHP 版本:8.1.13
php-fpm 版本:8.1.13
3). 当前系统
4). 业务环境
5). 相关软件版本
2. 问题描述?
注册用户后调用了事件 event(new CreateUser($user_id));
class CreateUserListener implements ShouldQueue
{
/**
Create the event listener. */
public function __construct()
{//}
/**
任务可尝试的次数。
*@var int /
public $tries = 5;
/*任务被处理的延迟时间(秒)
*- /
public $delay = 60;
/
public function handle(CreateUser $event): void
{
//做了一些后续处理
}
部署后,当用户handle里面的代码执行了,但是队列被标注为失败,failed_jobs表里面产生数据,日志里面:
[2024-06-17 16:53:27] local.ERROR: App\Listeners\CreateProjectListener has been attempted too many times. {“exception”:”[object] (Illuminate\Queue\MaxAttemptsExceededException(code: 0): App\Listeners\CreateProjectListener has been attempted too many times.
- /
3. 您期望得到的结果?
队列执行成功,标注为成功
//: <> (能截图就截图。)
4. 您实际得到的结果?
任务执行了,但是队列被标注为失败

//: <> (有报错信息的话把堆栈信息提供出来)

关于 LearnKu
推荐文章: