Correctness: callback completeness, ttl validation, RefreshTimeout, refresh-lock CAS - #13
Open
dcbickfo wants to merge 2 commits into
Open
Correctness: callback completeness, ttl validation, RefreshTimeout, refresh-lock CAS#13dcbickfo wants to merge 2 commits into
dcbickfo wants to merge 2 commits into
Conversation
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.
Follow-up to a thorough review of the v0.2.0 cycle. Fixes the one confirmed-new correctness sharp edge (the map-callback contract) plus the tracked RC-1/RC-5/RC-6 correctness items. No hot-path change; all tests green under
-race, lint clean.Fixed
GetMultino longer hangs (re-locking + re-invoking the callback until the ctx deadline) when the callback omits a requested key — it fails fast with an error naming the missing keys. The contract is now: the callback must return a value for every key it is given (empty string for a known-absent entity).SetMultino longer silently reverts + returnsnilfor callback-omitted keys — they're surfaced in the returnedBatchError.LockTTL(RC-1). A callback slower thanLockTTLwas cancelled mid-flight and mis-reported as an error, silently disabling refresh for slow-to-recompute values. The successful back-write now runs under a fresh context so a callback that consumed most of its budget still persists its value.tryGetMultilength guard (RC-5): fails loud on a truncatedDoMultiCacheresponse instead of silently dropping keys (mirrorswaitForReadLocks).Added
RefreshTimeoutoption — refresh-callback compute budget, decoupled fromLockTTL; defaults to the value's per-callttl.ttlvalidation acrossGet/GetMulti/Set/SetMulti/Touch/TouchMulti/ForceSet/ForceSetMulti— rejects non-positivettlup front instead of an opaque Redis error; notablyTouch/TouchMultino longer delete the key viaPEXPIRE 0.Changed
ForceSetMultiwraps its first error with key context (matchesDelMulti).mapsx.Values; doc fixes (lock-value wording, refresh best-effort note, README Go version /Close()/ Metrics list).Tests
callback_contract_test.goandrefresh_timeout_test.go(TDD: watched-fail then pass).Verification
go test -race ./...— green;golangci-lint run— 0 issues;go vet— clean.