我有一个工作队列,当网站管理员上传新视频时触发:
SendVideoNotifications::dispatch($video)
它将发送成百上千的排队通知,如下所示:
$users = User::where('active', true);
foreach ($users as $user) {
$notification = new VideoUploaded($this->video);
$user->notify($notification);
}
有时会随机出现队列超时
App\Notifications\VideoUploaded has been attempted too many times or run too long.
The job may have previously timed out.
这个答案https://stackoverflow.com/a/52275080/12375621似乎表明,同时对作业和通知进行排队的体系结构是不稳定的,但是我不确定我是否可以在PHP最终超时之前足够快地对数千封电子邮件进行排队。
还有其他人遇到这种情况吗?如何更改架构以完成我想要的?