-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.4] Cache based Schedule overlap locking #16196
Conversation
Any chance of a backport to 5.3 for this? |
@alexbowers isn't this breaking? an overlap might occur between update. |
What do you mean between update? |
I meant, while upgrading, the new check will look for a cache key while the first event used a lock file. |
That is the same surely whether you upgrade to 5.3.x or 5.4? The release process will have a breaking change between them. Or is the issue just because it is a patch version update? Any reasonable release process on multiple servers will include zero downtime, which would indicate that the release goes live on all servers at the same time, or that servers are taken out of circulation whilst the upgrade is going on, until all servers are upgraded and at the same state. After the upgrade period have completed, all servers will match, so having the mutex in a file, or in cache shouldn't make any difference, since they'd be using the same checking code. Any release process on a single server shouldn't matter, since there is only one cronjob to run at any one time anyway, so the mutex is largely meaningless here during the upgrade process. Or am i misunderstanding the issue? |
|
Wouldn't this be an issue in a In that case, A fix for that would be that if a cache key isn't found, to check for the lock file. This would make the upgrade process completely BC, and a later patch can remove the lock file, to make it not perform unnecessary actions (Whether 5.5, or 5.4.x) |
@@ -719,7 +729,7 @@ public function withoutOverlapping() | |||
$this->withoutOverlapping = true; | |||
|
|||
return $this->skip(function () { | |||
return file_exists($this->mutexPath()); | |||
return $this->cache->has($this->mutexName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@themsaid I believe this is the only line that would need to change to make it fully BC. Something like:
return $this->cache->has($this->mutexName()) || file_exists($this->mutexPath());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the unlink method too.
@themsaid: What happens if the cache is flushed? Wouldn't make even more sense use a database table? |
Any chance of this being back-ported to 5.1 LTS? |
This is an attempt to solve the following issue: laravel/ideas#69
Instead of using the file system to store a lock file, we use the cache store to allow any server to lock/check scheduled events.