Skip to content

Commit 8ebb5b8

Browse files
committed
Attempt to use atomic cache operation when checking for overlaps.
This will help prevent race conditions.
1 parent cf461e2 commit 8ebb5b8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Illuminate/Console/Scheduling/Event.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,9 @@ public function getDefaultOutput()
160160
*/
161161
public function run(Container $container)
162162
{
163-
if ($this->withoutOverlapping) {
164-
$this->cache->put($this->mutexName(), true, 1440);
163+
if ($this->withoutOverlapping &&
164+
! $this->cache->add($this->mutexName(), true, 1440)) {
165+
return;
165166
}
166167

167168
$this->runInBackground

0 commit comments

Comments
 (0)