Skip to content

Commit

Permalink
Attempt to use atomic cache operation when checking for overlaps.
Browse files Browse the repository at this point in the history
This will help prevent race conditions.
  • Loading branch information
taylorotwell committed Mar 16, 2017
1 parent cf461e2 commit 8ebb5b8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Illuminate/Console/Scheduling/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@ public function getDefaultOutput()
*/
public function run(Container $container)
{
if ($this->withoutOverlapping) {
$this->cache->put($this->mutexName(), true, 1440);
if ($this->withoutOverlapping &&
! $this->cache->add($this->mutexName(), true, 1440)) {
return;
}

$this->runInBackground
Expand Down

0 comments on commit 8ebb5b8

Please sign in to comment.