Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Scheduler] Continue with storedCheckpoint::$time on lock#52039
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Checkpoint::$time on lockUh oh!
There was an error while loading.Please reload this page.
nicolas-grekas commentedNov 15, 2023 • edited by OskarStark
Loading Uh oh!
There was an error while loading.Please reload this page.
edited by OskarStark
Uh oh!
There was an error while loading.Please reload this page.
I'm trying to understand what you mean here, I'm not deep enough into the topic 😬 Does your description also apply when there is no cache defined? How about this patch instead? --- a/src/Symfony/Component/Scheduler/Generator/Checkpoint.php+++ b/src/Symfony/Component/Scheduler/Generator/Checkpoint.php@@ -37,14 +37,12 @@ final class Checkpoint implements CheckpointInterface return false; }- if ($this->reset) {- $this->reset = false;- $this->save($now, -1);- }- if ($this->cache) { [$this->time, $this->index, $this->from] = $this->cache->get($this->name, fn () => [$now, -1, $now]) + [2 => $now]; $this->save($this->time, $this->index);+ } elseif ($this->reset) {+ $this->reset = false;+ $this->save($now, -1); } |
Uh oh!
There was an error while loading.Please reload this page.
Jeroeny commentedNov 16, 2023
That's an interesting case. I think that may indeed be the thought behind this reset. But, if they do have a shared cache, I think worker two can continue where worker one left off. As I'd say that is the purpose of the cache.
With the above reasoning, that patch does indeed work. I've added a test to specifically test a second checkpoint acquiring the lock after the first and test that it continues from the saved time. |
fba8bab toab1d7fdComparenicolas-grekas commentedNov 17, 2023
Thank you@Jeroeny. |
Uh oh!
There was an error while loading.Please reload this page.
When there are multiple message-consumer processes running, the Lock mechanism can be used to ensure a single process takes responsibility of the scheduling.
However when the responsible process releases the lock and a new process acquires it, the state of the checkpoint is reset on purpose.
I'm not sure what the reason behind this is. Maybe I'm missing something and this PR isn't valid. But it seems strange that a Checkpoint stores it's progress which is then lost when that process stops.
Perhaps the 'reset' was more intended like a `reload', since the cached value may have changed by another process? Then this PR would fix it to be an actual reload.
Also I think the change in logic requires this to go to
6.4branch?