Skip to content

Commit

Permalink
Fix race condition checking if event mutex exists
Browse files Browse the repository at this point in the history
  • Loading branch information
vkulov committed Jan 31, 2025
1 parent fcd058f commit 35f5338
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Illuminate/Console/Scheduling/CacheEventMutex.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ public function create(Event $event)
public function exists(Event $event)
{
if ($this->shouldUseLocks($this->cache->store($this->store)->getStore())) {
return ! $this->cache->store($this->store)->getStore()
->lock($event->mutexName(), $event->expiresAt * 60)
->get(fn () => true);
return $this->cache->store($this->store)->getStore()
->get($event->mutexName()) !== null;
}

return $this->cache->store($this->store)->has($event->mutexName());
Expand Down

0 comments on commit 35f5338

Please sign in to comment.