亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

即使給出嘗試計數后,Laravel 隊列仍處于處理狀態

即使給出嘗試計數后,Laravel 隊列仍處于處理狀態

PHP
弒天下 2023-09-22 14:40:30
嘗試使用作業發送推送通知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:workphp 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<?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貢獻2012條經驗 獲得超12個贊

“如果出現任何問題,作業將自動失敗并重試,處理超時錯誤的方法是加快作業速度或增加超時時間。當發生超時時,作業會重試。因此理論上,您最終可能會運行 2 個相同的作業如果超時太低。如果作業意外崩潰并且不報告失敗,這是一種恢復方法?!?/p>

所以我改變了解決我的問題的建議php artisan queue:work --memory=256 --timeout=600 --tries=3。


查看完整回答
反對 回復 2023-09-22
  • 1 回答
  • 0 關注
  • 110 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號