Skip to content

Commit

Permalink
Fix watch to include only recent events on rev<=0
Browse files Browse the repository at this point in the history
Signed-off-by: Byron Ruth <[email protected]>
  • Loading branch information
bruth committed Aug 20, 2023
1 parent edd0875 commit 003b4c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/drivers/nats/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,5 +376,5 @@ func TestBackend_Watch(t *testing.T) {
events = append(events, es...)
}

expEqual(t, 5, len(events))
expEqual(t, 1, len(events))
}
2 changes: 1 addition & 1 deletion pkg/drivers/nats/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func (e *KeyValue) watchStream(ctx context.Context, filter, keyPrefix string, st
}

if startRev <= 0 {
cfg.DeliverPolicy = jetstream.DeliverNewPolicy
cfg.DeliverPolicy = jetstream.DeliverLastPerSubjectPolicy
} else {
cfg.DeliverPolicy = jetstream.DeliverByStartSequencePolicy
cfg.OptStartSeq = startRev
Expand Down

0 comments on commit 003b4c9

Please sign in to comment.