feat(queuev2): add InMemQueue, cache config, and task key helpers#7954
feat(queuev2): add InMemQueue, cache config, and task key helpers#7954arzonus wants to merge 1 commit intocadence-workflow:masterfrom
Conversation
45aa0a2 to
ae626f8
Compare
a3bb473 to
ab9fe3a
Compare
Signed-off-by: Seva Kaloshin <seva.kaloshin@gmail.com>
ab9fe3a to
42af244
Compare
CI failed: The `TestReplicationSimulation` integration test failed due to a `deadline-exceeded` error during a regional failover operation, likely caused by latency or synchronization issues introduced by the new `queuev2` components.OverviewThe FailuresReplication Simulation Failure (confidence: medium)
Summary
Code Review ✅ Approved 3 resolved / 3 findingsInMemQueue implementation now safely handles zero-page-size requests, optimizes memory efficiency by truncating before collection, and prevents memory leaks by clearing interface references. All identified logic and memory management issues are resolved. ✅ 3 resolved✅ Bug: GetTasks panics when PageSize is 0 and tasks match
✅ Performance: GetTasks collects all matching tasks before truncating to PageSize
✅ Performance: RTrimBySize retains GC references to trimmed interface values
Rules ✅ All requirements metRepository Rules
1 rule not applicable. Show all rules by commenting Tip Comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|
Closing in favour of a single consolidated draft PR. All changes are preserved in the feature branch. |
What changed?
Adds the foundational building blocks for the cached timer queue reader (relates to #7953):
InMemQueue— a sorted in-memory task store backed by binary-search insertion, withPutTasks,GetTasks,LookAHead,LTrim,RTrimBySize, andClear. Deduplicates on insert by task key.TimerProcessorCacheMaxSize,CacheMaxLookAheadWindow,CachePrefetchTriggerWindow,CacheWarmupGracePeriod,CacheEvictionSafeWindow,CacheMinPrefetchInterval,CacheTimeEvictionInterval,CachedQueueReaderMode,EnableCachedScheduledQueue). All are global (no shard filter).HistoryTaskKey.LessandHistoryTaskKey.Equalhelpers used byInMemQueuefor ordering and deduplication.Why?
The timer queue reader currently issues a DB round-trip for every
GetTaskcall. The goal is to eliminate those reads for tasks that fall within a pre-fetched look-ahead window. This PR lays the groundwork — theInMemQueueis the in-memory store the cached reader will use, and the config properties control its behaviour. Nothing is wired into production code yet.How did you test it?
All passed.
Potential risks
None — no changes to existing production code paths. All new types and config keys.
Release notes
N/A — internal change, not user-facing.
Documentation Changes
N/A