Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use BindStream for watcher so it works with mirrors. #1116

Merged
merged 1 commit into from Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion kv.go
Expand Up @@ -926,7 +926,7 @@ func (kv *kvs) Watch(keys string, opts ...WatchOpt) (KeyWatcher, error) {
}

// Used ordered consumer to deliver results.
subOpts := []SubOpt{OrderedConsumer()}
subOpts := []SubOpt{BindStream(kv.stream), OrderedConsumer()}
if !o.includeHistory {
subOpts = append(subOpts, DeliverLastPerSubject())
}
Expand Down
5 changes: 5 additions & 0 deletions test/kv_test.go
Expand Up @@ -968,6 +968,11 @@ func TestKeyValueMirrorCrossDomains(t *testing.T) {
t.Fatalf("Got wrong value: %q vs %q", e.Value(), "rip")
}

// Also make sure we can create a watcher on the mirror KV.
watcher, err := mkv.WatchAll()
expectOk(t, err)
defer watcher.Stop()

// Bind through leafnode connection but to origin KV.
rjs, err := lnc.JetStream(nats.Domain("HUB"))
expectOk(t, err)
Expand Down