Reduce WORKER_LOCK_MAX_RETRY_INTERVAL to 5 seconds#19755
Merged
MadLittleMods merged 4 commits intoMay 7, 2026
Conversation
Better to retry more quickly than have workers wait around. 5 seconds is still a reasonable gap in time to no overwhelm anything. This matters in cross-worker scenarios. When locks are on the same worker, when the locker holder releases, we signal to other locks that they should try reacquiring the lock immediately. But locks on other workers for the same keys only re-check based on their retry `_timeout_interval`. Updating to 5 seconds to match the previous intentions based on the [flawed code] (https://github.com/element-hq/synapse/blob/6100f6e4f7fb0c72f1ae2802683ebc811c0e3a77/synapse/handlers/worker_lock.py#L278). We can assume they were trying to have 5 seconds as the max value to retry.
3 tasks
erikjohnston
approved these changes
May 7, 2026
Contributor
Author
|
Thanks for the review @erikjohnston 🐕🦺 |
3 tasks
MadLittleMods
commented
May 11, 2026
Comment on lines
+64
to
+67
| This matters most in cross-worker scenarios. When locks are on the same worker, when the | ||
| lock holder releases, we signal to other locks (with the same name/key) that they | ||
| should try reacquiring the lock immediately. But locks on other workers only re-check | ||
| based on their retry `_timeout_interval`. |
Contributor
Author
There was a problem hiding this comment.
Updating this reasoning in #19772 (comment)
FrenchGithubUser
pushed a commit
to famedly/synapse-upstreaming
that referenced
this pull request
Jun 12, 2026
Better to retry more quickly than have workers wait around. 5 seconds is still a reasonable gap in time to not overwhelm anything. This matters most in cross-worker scenarios. When locks are on the same worker, when the lock holder releases, we signal to other locks (with the same name/key) that they should try reacquiring the lock immediately. But locks on other workers only re-check based on their retry `_timeout_interval`. Updating to 5 seconds to match the previous intentions based on the [flawed code](https://github.com/element-hq/synapse/blob/6100f6e4f7fb0c72f1ae2802683ebc811c0e3a77/synapse/handlers/worker_lock.py#L278). We can assume they were trying to have 5 seconds as the max value to retry. Spawning from element-hq#19394 (comment)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reduce
WORKER_LOCK_MAX_RETRY_INTERVALto 5 seconds.Better to retry more quickly than have workers wait around. 5 seconds is still a reasonable gap in time to not overwhelm anything.
This matters most in cross-worker scenarios. When locks are on the same worker, when the lock holder releases, we signal to other locks (with the same name/key) that they should try reacquiring the lock immediately. But locks on other workers only re-check based on their retry
_timeout_interval.Updating to 5 seconds to match the previous intentions based on the flawed code. We can assume they were trying to have 5 seconds as the max value to retry.
Spawning from #19394 (comment)
Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.