2016-05-16 51 views
1

我在Ubuntu 14.04服務器中使用數據庫驅動程序實現了laravel隊列。我執行此代碼Laravel數據庫排隊作業嘗試

php /path to app/artisan queue:listen --tries=3 --env=local 

它說試試= 3。但是當我看到就業表時,我看到有22次嘗試的工作,這怎麼可能?它應該嘗試3次,然後將其添加到failed_jobs表中。

此外,在作業表中reserved_at意味着什麼?

謝謝

這裏是,順便說一下,它完美

<?php 

namespace App\Jobs; 

use App\Jobs\Job; 
use App\Notifiers\Im_Notification; 
use App\Notifiers\Notification; 
use App\Notifiers\Mail_Notification; 
use App\Reservation; 
use Illuminate\Queue\SerializesModels; 
use Illuminate\Queue\InteractsWithQueue; 
use Illuminate\Contracts\Queue\ShouldQueue; 

class NotifyPlaceReservationStatus extends Job implements ShouldQueue 
{ 
    use InteractsWithQueue, SerializesModels; 

/** 
* Create a new job instance. 
* 
* @return void 
*/ 
protected $notification; 
protected $reservation; 
protected $info_changed; 

public function __construct(Notification $notification,Reservation $reservation) 
{ 
    $this->reservation = $reservation; 
    $this->notification = $notification; 
} 

/** 
* Execute the job. 
* 
* @return void 
*/ 
public function handle() 
{ 
    $this->notification->notifyPlaceReservationStatus($this->reservation); 
} 

public function failed() 
{ 
    error_log('Job failed'); 
} 
} 
+0

你應該顯示作業它自我。問題可能在於此。 –

+0

好吧,我把它。謝謝 –

回答

0

當您提供的CLI嘗試次數工作,Laravel工人要去申請的嘗試限制僅適用於當前在隊列中的那些工作(如果您願意,也可以在您未執行的工作表中)。爲了使工作的每一個執行有一個嘗試的限制,你應該把公共$嘗試屬性,在招聘類作爲Dispatching Jobs的Laravel文檔中所述(對於Laravel 5.4)

public $tries = 3; 
protected $notification; 
protected $reservation; 
protected $info_changed;