Skip to content

QuoteHub: Ignore Insert/Add operations for quotes preceding current timeline #1956

@coderabbitai

Description

@coderabbitai

Problem

When QuoteHub has pruned historical quotes and the cache contains only the most recent N quotes, calling Insert(quote) or Add(quote) with a quote that precedes the current timeline (before the first timestamp in the cache) creates an indeterminate gap in the data.

Current Behavior

  • After pruning, cache contains quotes [500..2000] (if max cache size is 1500)
  • Calling Insert(quote_100) would:
    • Slot in at beginning of timeline
    • Create gap: quote 100, then missing 101-499, then 500-2000
    • Increase cache size without triggering prune
    • Send rebuild command to subscribers

Expected Behavior

QuoteHub should ignore Insert and Add operations for quotes that precede the current timeline (before Results[0].Timestamp after pruning).

Implementation Notes

  • Check if incoming quote timestamp is before Results[0].Timestamp
  • If yes, ignore the operation (no-op)
  • Consider logging a debug message for such cases
  • This prevents indeterminate gaps and maintains timeline integrity

Related

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions