invalidate local cache on is_negative_hits - #1230
Open
oclaw wants to merge 1 commit into
Open
Conversation
oclaw
commented
Sep 1, 2026
| // DecrementScript atomically decrements a rate limit counter, floored at 0. | ||
| // If the key does not exist there is nothing to refund, so it returns 0 without | ||
| // creating a phantom key. | ||
| const DecrementScript = ` |
Author
There was a problem hiding this comment.
This is not really a common limiter part, moved it closer to Redis backend impl
oclaw
commented
Sep 1, 2026
Author
There was a problem hiding this comment.
Reused driver.go as much as possible but this routine has quite independent connection cycle so decided not to bother too much
oclaw
commented
Sep 1, 2026
| if hitsAddends[i].IsNegative { | ||
| pipelineAppendDecrement(client, p, cacheKey.Key, hitsAddends[i].Value, &results[i], expirationSeconds) | ||
| // The subscriber listens only on the main Redis. | ||
| publishInvalidation := this.publishInvalidations && !onPerSecondRedis |
Author
There was a problem hiding this comment.
dedicated per second redis assume high load and redis-backed refunds are barely effective here, not doing them (and the invalidator only listens main redis at the moment)
oclaw
force-pushed
the
negative-hits-flag-invalidation
branch
2 times, most recently
from
September 1, 2026 14:45
1e9ab1b to
0602802
Compare
…cal cache on refunds Signed-off-by: Daniil Kogtev <oclaw@icloud.com>
oclaw
force-pushed
the
negative-hits-flag-invalidation
branch
from
September 1, 2026 14:51
0602802 to
ef92df1
Compare
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.
Problem
is_negative_hits (#1140) lets a descriptor decrement previously consumed quota, but refunds are invisible to the local over-limit cache: once a replica cached a key as over limit, a refund that freed quota in Redis kept being answered OVER_LIMIT from every replica's local cache until the window ended which degrades the feature on long windows
Suggested design
P.S. Agent also added some missing tests for touched components, look fine