Repository navigation
Conversation
A run now refreshes its lock every third of lockTtlMs, so the lock is only reclaimed once its holder died, however long the run takes. The lock records which run holds it: a run that lost its lock refuses to commit (blue/green does not swap the alias, in-place does not sweep), and releasing never deletes another run’s lock.
This branch has not been deployed
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.
The rebuild lock recorded
acquired_atonce and never refreshed it. A healthy run that took longer thanlockTtlMslost its lock, so a second run could start alongside it, commit before it, and then have its newer data swapped out by the older run’s late commit. The older run’s release then deleted the newer run’s lock as well.This change does what the issue proposes:
lockTtlMs / 3. The timer is unref’d, stops on release, and stops once the lock belongs to someone else. A refresh that fails is retried on the next beat. Another run can now only take the lock over once its holder has died, so the TTL no longer caps how long a rebuild may take. There is no maximum runtime.releasedeletes the lock only while this run still owns it, andcommitchecks ownership before going live: blue/green does not swap the alias and in-place does not sweep. A run that lost its lock rejects its commit, and the pipeline then aborts it.Internally,
acquireLocknow returns aHeldLock(assertHeld,release) in place of a boolean, and the writers get that lock fromopenLockedRun. None of this is exported, so the public API is unchanged. I wrote the port contract into theRebuildAlreadyRunningJSDoc and the “Rebuild requests” section of the@lde/searchdocs, and updated the concurrency section of thesearch-typesensedocs.Older lock documents have no owner. They are still reclaimed once stale, and no run will delete one.
Fixes #968