fix(query-orchestrator): align pre-aggregation refresh key cache TTL with renewalThreshold#10993
Open
igorferst wants to merge 1 commit into
Open
fix(query-orchestrator): align pre-aggregation refresh key cache TTL with renewalThreshold#10993igorferst wants to merge 1 commit into
igorferst wants to merge 1 commit into
Conversation
…with renewalThreshold Co-authored-by: Cursor <cursoragent@cursor.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.
Summary
Pre-aggregation refresh key queries were cached with a hardcoded 1-hour Redis TTL in
PreAggregationLoadCache.keyQueryResult, whilerefresh_key.everyonly controlledrenewalThreshold. Wheneverywas longer than one hour (e.g.15 days), the cache entry expired hourly, so refresh-key SQL still ran about every hour despite the model config.This PR sets cache expiration to
max(renewalThreshold, 1 hour)using the same resolved threshold as today (refresh_key.every, orqueryCacheOptions.refreshKeyRenewalThreshold).Why
renewalThresholdand Redis TTL were out of sync: stale logic could allow 15-day reuse in theory, but the key was removed after 1 hour → cache miss → refresh-key SQL re-executed.Math.max(renewalThreshold, 60 * 60)fixes longeveryvalues and preserves the previous minimum 1-hour TTL for short thresholds (sqlwithoutevery, default ~10s renewal, etc.).Behavior changes
sql+every: '15 days'sqlonly (renewalThreshold~10s)refreshKeyRenewalThresholdin orchestratorMade with Cursor