Repository navigation
refactor(lock): give each manager its own timings, so tests stop writing package globals - #157
Merged
Merged
Conversation
…package globals Lock tests shortened holdTurn, cacheGrace, renewAfter, acquireTimeout, tornExpiry and longHold by writing package variables and restoring them in a defer, while cache-expiry timers and watchers started by earlier tests still read them. The nightly race run caught one: a test's deferred holdTurn restore against another test's expireCached. These settings and yieldGap and releaseRetry are now fields of the manager, set to the defaults in NewManager. Tests set them on the managers they create, before using them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Unblocks #144's Race x3 job. Lock tests shortened
holdTurn,cacheGrace,renewAfter,acquireTimeout,tornExpiryandlongHoldby writing package variables, while cache-expiry timers and watchers from earlier tests still read them. On main, Race x3 on .68 reproduces the reported race:safety_test.go:145's deferredholdTurnrestore against another test'sexpireCached→turnOverLocked.These six, plus
yieldGapandreleaseRetry, are now onetimingsfield per Manager, with defaults set inNewManager. Tests set them on their own managers before using them. Runtime behavior does not change.Evidence (.68, the exact Race x3 command:
go test -race -count=3over lock, journal, inode and dir):🤖 Generated with Claude Code