【发布时间】:2019-09-09 18:10:22
【问题描述】:
我有一个用 laravel 编写的工作项目,我已经集成了 Sentry 来监控错误,我按照他们网站上的说明进行操作,基本上只是
composer 需要 sentry/sentry-laravel
在我的 App/Exceptions/Handler.php 中
if (app()->bound('sentry') && $this->shouldReport($exception)) {
app('sentry')->captureException($exception);
}
现在这工作正常,我在哨兵中看到错误。 但是在我使用队列的应用程序的另一端,例如我有“忘记密码”通知,它实际上实现了 ShouldQueue 类:
<?php
namespace App\Notifications\Auth;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
class PasswordResetRequest extends Notification implements ShouldQueue
{
use Queueable;
protected $token;
public function __construct($token)
{
$this->token = $token;
}
public function via($notifiable)
{
return ['mail'];
}
public function toMail($notifiable)
{
$url = url('/password/find/'.$this->token);
return (new MailMessage)
->line('You are receiving this email because we received a password reset request for your account.')
->action('Reset Password', url($url))
->line('If you did not request a password reset, no further action is required.');
}
}
当触发按预期工作时,我在作业表中有一条新记录(我有数据库作为队列驱动程序)
现在当我开始工作时
php 工匠队列:工作
它会一遍又一遍地停止上次工作的工作
没有邮件发送或接收...
顺便说一句,这只是当我在哨兵中报告时,如果我在 report() 方法中删除 App/Exceptions/Handler.php 中的那些行,这一切都很好,如果我从通知中删除队列它也有效,只有哨兵错误报告和通知队列的组合让我成为一个大问题。
【问题讨论】: