尝试使用作业发送推送通知
php artisan queue:work
当我运行并Supervisor
继续处理单个队列项目多次时,工作人员不会抛出超时错误
当我尝试时php artisan queue:listen
,它给我一个错误,60 秒后超时。
The process "'/usr/bin/php7.2' 'artisan' queue:work '' --once --queue='default' --delay=0 --memory=128 --sleep=3 --tries=0" exceeded the timeout of 60 seconds.
我可以让处理程序在 60 秒内处理所有内容,但我想解决这个问题。
我缺少什么?
工作正在消亡,没有完成,也没有失败
我在用Laravel 5.5
我与主管一起运行的命令是php artisan queue:work
php artisan queue:restart
也尝试运行并重新启动主管!
主管工人日志
[2020-08-07 13:26:35] Processing: App\Jobs\SendNotifications
[2020-08-07 13:28:05] Processing: App\Jobs\SendNotifications
[2020-08-07 13:29:36] Processing: App\Jobs\SendNotifications
[2020-08-07 13:31:07] Processing: App\Jobs\SendNotifications
[2020-08-07 13:32:38] Processing: App\Jobs\SendNotifications
[2020-08-07 13:34:08] Processing: App\Jobs\SendNotifications
[2020-08-07 13:35:39] Processing: App\Jobs\SendNotifications
发送通知.php
<?php
namespace App\Jobs;
use Exception;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Redis;
class SendNotifications implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $payload;
/**
* The number of times the job may be attempted.
*
* @var int
*/
public $tries = 3;
/**
* The number of seconds the job can run before timing out.
*
* @var int
*/
public $timeout = 60;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($payload)
{
$this->payload = $payload;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
try {
$this->handleNotifications($this->payload);
} catch (Exception $e) {
$this->failed($e);
}
}
/**
* The job failed to process.
*
* @param Exception $exception
* @return void
*/
繁花如伊