Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged
nicolas-grekas merged 1 commit intosymfony:6.4fromJeroeny:fixschedulereset
Nov 17, 2023

Conversation

@Jeroeny
Copy link
Contributor

@JeroenyJeroeny commentedOct 13, 2023
edited by nicolas-grekas
Loading

QA
Branch?6.4
Bug fix?yes
New feature?no
Deprecations?no
LicenseMIT

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 to6.4 branch?

@carsonbotcarsonbot added this to the6.4 milestoneOct 13, 2023
@JeroenyJeroeny changed the title[Scheduler] Continue with checkpoint time on lock[Scheduler] Continue with storedCheckpoint::$time on lockOct 13, 2023
@fabpotfabpot added the ❄️ Feature FreezeImportant Pull Requests to finish before the next Symfony "feature freeze" labelOct 20, 2023
@nicolas-grekasnicolas-grekas removed the ❄️ Feature FreezeImportant Pull Requests to finish before the next Symfony "feature freeze" labelOct 20, 2023
@nicolas-grekas
Copy link
Member

nicolas-grekas commentedNov 15, 2023
edited by OskarStark
Loading

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);         }

@nicolas-grekasnicolas-grekas modified the milestones:6.4,7.1Nov 15, 2023
@ycerutoyceruto modified the milestones:6.4,7.1Nov 15, 2023
@Jeroeny
Copy link
ContributorAuthor

Does you description also apply when there is no cache defined?

That's an interesting case. I think that may indeed be the thought behind this reset.
Because if you have two processes running without shared cache, apparently you do not want them to continue from exactly the last saved time. So maybe to prevent re-processing a certain time frame in a second worker when it has acquired a lock after another worker, it gets 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.

How about this patch instead?

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.

@nicolas-grekasnicolas-grekas changed the base branch from7.1 to6.4November 17, 2023 21:09
@nicolas-grekas
Copy link
Member

Thank you@Jeroeny.

@nicolas-grekasnicolas-grekas merged commit6f63e25 intosymfony:6.4Nov 17, 2023
This was referencedNov 26, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@kbondkbondAwaiting requested review from kbondkbond is a code owner

@nicolas-grekasnicolas-grekasAwaiting requested review from nicolas-grekas

@xabbuhxabbuhAwaiting requested review from xabbuh

@lyrixxlyrixxAwaiting requested review from lyrixx

@dunglasdunglasAwaiting requested review from dunglas

@ycerutoycerutoAwaiting requested review from yceruto

@welcoMatticwelcoMatticAwaiting requested review from welcoMattic

@chalasrchalasrAwaiting requested review from chalasr

@OskarStarkOskarStarkAwaiting requested review from OskarStark

@jderussejderusseAwaiting requested review from jderusse

Assignees

No one assigned

Projects

None yet

Milestone

6.4

Development

Successfully merging this pull request may close these issues.

5 participants

@Jeroeny@nicolas-grekas@fabpot@yceruto@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp