You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which means that cache:clear will wipe those locks and allow another server to pick up the task.
Thoughts
I'm not familiar enough with the source to send a PR, and I don't know if there's a good reason for this behavior. Naively I would assume that onOneServer() should use CacheEventMutex in stead of CacheSchedulingMutex(which is apparently only used in this context).
Steps To Reproduce
Use a cache driver with a separate lock_connection
Configure a scheduled job with onOneServer(), which calls sleep(60).
Run schedule:run
Observe where the lock is stored.
The text was updated successfully, but these errors were encountered:
Laravel Version
12.10.2
PHP Version
8.3.20
Database Driver & Version
No response
Description
Context
In
config/cache.php
you can define a separate connection to use for locks:https://github.com/laravel/laravel/blob/f6e4638ee6ca1cd40aa7c56311d89ea3d91a24f8/config/cache.php#L74-L78
This makes it possible to run
cache:clear
without losing mutexes and atomic locks.The lock_connection is used when calling
Cache::lock(...)->get()
Schedule::command(...)->withoutOverlapping()
It might be used in other contexts too, but those are the ones I'm aware of.
The problem
Schedule::command(...)->onOneServer()
creates the lock on the regular cache connection viaframework/src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php
Lines 41 to 46 in bcc9220
Which means that
cache:clear
will wipe those locks and allow another server to pick up the task.Thoughts
I'm not familiar enough with the source to send a PR, and I don't know if there's a good reason for this behavior. Naively I would assume that
onOneServer()
should useCacheEventMutex
in stead ofCacheSchedulingMutex
(which is apparently only used in this context).Steps To Reproduce
onOneServer()
, which calls sleep(60).schedule:run
The text was updated successfully, but these errors were encountered: