Skip to content

Commit

Permalink
Merge d09392c into 2c5733a
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrpio committed May 18, 2023
2 parents 2c5733a + d09392c commit 4be87c5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions js_test.go
Expand Up @@ -537,20 +537,24 @@ func TestJetStreamConcurrentQueueDurablePushConsumers(t *testing.T) {
}

// Now create 10 durables concurrently.
subs := make(chan *Subscription, 10)
subsCh := make(chan *Subscription, 10)
var wg sync.WaitGroup

for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
defer wg.Done()
sub, _ := js.QueueSubscribeSync("foo", "bar")
subs <- sub
subsCh <- sub
}()
}
// Wait for all the consumers.
wg.Wait()
close(subs)
close(subsCh)
subs := make([]*Subscription, 0, len(subsCh))
for sub := range subsCh {
subs = append(subs, sub)
}

si, err := js.StreamInfo("TEST")
if err != nil {
Expand All @@ -570,7 +574,7 @@ func TestJetStreamConcurrentQueueDurablePushConsumers(t *testing.T) {
got := 0
for time.Now().Before(timeout) {
got = 0
for sub := range subs {
for _, sub := range subs {
pending, _, _ := sub.Pending()
// If a single sub has the total, then probably something is not right.
if pending == total {
Expand Down

0 comments on commit 4be87c5

Please sign in to comment.