Laravel - Set queue delay dynamically for event listener

*爱你&永不变心* 提交于 2020-12-15 07:01:27

问题


Based on the documentation of Laravel to delay the job, we can add a $delay properties on the listener class (https://laravel.com/docs/8.x/events). I am trying to customize the $delay time in seconds that based on my start time and end time.

From documentation which it's work fine:

/**
 * The time (seconds) before the job should be processed.
 *
 * @var int
 */
public $delay = 60;

I am trying to:

public $delay;
public function __construct ($event) {
    $this->delay= $event->seconds;
}

and I tried this for making sure it will work but unfortunate not:

 public $delay;
public function __construct () {
    $this->delay= "60";
}

来源:https://stackoverflow.com/questions/64727992/laravel-set-queue-delay-dynamically-for-event-listener

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!