嘗試使用作業(yè)發(fā)送推送通知php artisan queue:work當(dāng)我運(yùn)行并Supervisor繼續(xù)處理單個(gè)隊(duì)列項(xiàng)目多次時(shí),工作人員不會(huì)拋出超時(shí)錯(cuò)誤當(dāng)我嘗試時(shí)php artisan queue:listen,它給我一個(gè)錯(cuò)誤,60 秒后超時(shí)。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 秒內(nèi)處理所有內(nèi)容,但我想解決這個(gè)問(wèn)題。我缺少什么?工作正在消亡,沒(méi)有完成,也沒(méi)有失敗我在用Laravel 5.5我與主管一起運(yùn)行的命令是php artisan queue:workphp artisan queue:restart也嘗試運(yùn)行并重新啟動(dòng)主管!主管工人日志[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發(fā)送通知.php<?phpnamespace 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 */
1 回答

繁花如伊
TA貢獻(xiàn)2012條經(jīng)驗(yàn) 獲得超12個(gè)贊
“如果出現(xiàn)任何問(wèn)題,作業(yè)將自動(dòng)失敗并重試,處理超時(shí)錯(cuò)誤的方法是加快作業(yè)速度或增加超時(shí)時(shí)間。當(dāng)發(fā)生超時(shí)時(shí),作業(yè)會(huì)重試。因此理論上,您最終可能會(huì)運(yùn)行 2 個(gè)相同的作業(yè)如果超時(shí)太低。如果作業(yè)意外崩潰并且不報(bào)告失敗,這是一種恢復(fù)方法?!?/p>
所以我改變了解決我的問(wèn)題的建議php artisan queue:work --memory=256 --timeout=600 --tries=3
。
- 1 回答
- 0 關(guān)注
- 122 瀏覽
添加回答
舉報(bào)
0/150
提交
取消