Skip to content

Commit 6132317

Browse files
committed
add unused sequence flag for non channel removal sequences
1 parent 5279ac8 commit 6132317

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

db/change_cache.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ func (c *changeCache) DocChanged(event sgbucket.FeedEvent) {
453453
// the two conditions above together means that the cache expect ue to run processEntry on this sequence as its pending
454454
// If seq >= c.getOldestSkippedSequence(ctx) and seq < current sequence allocated to the doc this means
455455
// that this sequence never arrived over the caching feed due to deduplication and was pushed to a skipped sequence list
456+
// We need check for 0 oldestSkipped because if the skipped list is empty 0 is returned
456457
isSkipped := (seq < currentSequence && seq >= oldestSkipped) && oldestSkipped != 0
457458
if (seq >= nextSequence && seq < currentSequence) || isSkipped {
458459
base.InfofCtx(ctx, base.KeyCache, "Received deduplicated #%d in recent_sequences property for (%q / %q)", seq, base.UD(docID), syncData.CurrentRev)
@@ -469,7 +470,7 @@ func (c *changeCache) DocChanged(event sgbucket.FeedEvent) {
469470
change.RevID = atRevId
470471
change.Channels = channelRemovals
471472
} else {
472-
// Todo: add unused seq flag here (needs rebase)
473+
change.UnusedSequence = true // treat as unused sequence when sequence is not channel removal
473474
}
474475

475476
changedChannels := c.processEntry(ctx, change)

0 commit comments

Comments
 (0)