Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions bridgev2/portalbackfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ func (portal *Portal) cutoffMessages(ctx context.Context, messages []*BackfillMe
if lastMessage == nil {
return messages
}
if forward {
if forward && !aggressiveDedup {
// With aggressive dedup, the ID-based pass below decides what's already bridged, so this
// timestamp prefix-trim is skipped.
cutoff := -1
for i, msg := range messages {
if msg.ID == lastMessage.ID || msg.Timestamp.Before(lastMessage.Timestamp) {
Expand All @@ -265,7 +267,7 @@ func (portal *Portal) cutoffMessages(ctx context.Context, messages []*BackfillMe
Msg("Cutting off forward backfill messages older than latest bridged message")
messages = messages[cutoff+1:]
}
} else {
} else if !forward {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should we apply the aggressiveDedup guard here too so both forward/backward are the same (aggressive is forced and any prefix shortcuts disabled).

cutoff := -1
for i := len(messages) - 1; i >= 0; i-- {
if messages[i].ID == lastMessage.ID || messages[i].Timestamp.After(lastMessage.Timestamp) {
Expand Down
Loading