Skip to content

Conversation

@torcolvin
Copy link
Collaborator

[4.0.3 backport] CBG-5073: Deduplicate channel set outside processEntry

cherry-pick of d469545

Copilot AI review requested due to automatic review settings January 16, 2026 15:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR backports changes that refactor channel set handling in the change cache implementation to use slices instead of maps, with deduplication occurring after entry processing rather than during it.

Changes:

  • Refactored AddToCache to return []channels.ID instead of channels.Set
  • Updated all callers to convert channel slices to sets after processing
  • Added dedicated notifyChange helper function for consistent channel notification handling

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
db/channel_cache.go Changed AddToCache return type from channels.Set to []channels.ID, using slice append instead of set operations
db/change_cache_test.go Updated test comments from notifyChange to notifyChangeFunc to match renamed field
db/change_cache.go Refactored channel tracking to use slices during processing, added notifyChange helper, converted slices to sets before notification

// push unused range to either pending or skipped lists based on current state of the change cache
allChangedChannels = c.processUnusedRange(ctx, fromSequence, toSequence, allChangedChannels, timeReceived)
changedChannels := c.processUnusedRange(ctx, fromSequence, toSequence, timeReceived)
allChangedChannels.Update(channels.SetFromArrayNoValidate(changedChannels))
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value of Update is not being captured. Since the method likely returns the updated set rather than modifying in place, this line should be allChangedChannels = allChangedChannels.Update(...) to preserve the changes.

Suggested change
allChangedChannels.Update(channels.SetFromArrayNoValidate(changedChannels))
allChangedChannels = allChangedChannels.Update(channels.SetFromArrayNoValidate(changedChannels))

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants