讨论数量:
/**
* Do not allow the event to overlap each other.
*
* @param int $expiresAt
* @return $this
*/
public function withoutOverlapping($expiresAt = 1440)
{
$this->withoutOverlapping = true;
$this->expiresAt = $expiresAt;
return $this->then(function () {
$this->mutex->forget($this);
})->skip(function () {
return $this->mutex->exists($this);
});
}
/**
* Attempt to obtain an event mutex for the given event.
*
* @param \Illuminate\Console\Scheduling\Event $event
* @return bool
*/
public function create(Event $event)
{
return $this->cache->store($this->store)->add(
$event->mutexName(), true, $event->expiresAt * 60
);
}
去看到文档这个withoutOverlapping
方法,作用是在一定时间内防止重复执行。
方法默认参数$expiresAt = 1440
代表24 * 60
为一天的时间。
也就是说1天内
该命令不在执行,这个时候只要你的调度在这个时间内,程序是不执行的。
一楼正解
推荐文章: