Browse Source

pubsub: Use distinct client IDs for test subscriptions. (#7178) (#7179)

Fixes #7176. Some of the benchmarks create a bunch of different subscriptions all sharing the same query. These were all using the same client ID, which violates one of the subscriber rules. Ensure each subscriber gets a unique ID.

This has been broken as long as this library has been in the repo—I tracked it back to bb9aa85d and it was already failing there, so I think this never really worked. I'm not sure these test anything useful, but at least now they run.

(cherry picked from commit 1fd7060542)

Co-authored-by: M. J. Fromberger <fromberger@interchain.io>
pull/7180/head
mergify[bot] 3 years ago
committed by GitHub
parent
commit
8314f24d79
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      libs/pubsub/pubsub_test.go

+ 2
- 1
libs/pubsub/pubsub_test.go View File

@ -518,7 +518,8 @@ func benchmarkNClientsOneQuery(n int, b *testing.B) {
ctx := context.Background() ctx := context.Background()
q := query.MustParse("abci.Account.Owner = 'Ivan' AND abci.Invoices.Number = 1") q := query.MustParse("abci.Account.Owner = 'Ivan' AND abci.Invoices.Number = 1")
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
subscription, err := s.Subscribe(ctx, clientID, q)
id := fmt.Sprintf("clientID-%d", i+1)
subscription, err := s.Subscribe(ctx, id, q)
if err != nil { if err != nil {
b.Fatal(err) b.Fatal(err)
} }


Loading…
Cancel
Save