File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ package pulsar
2020import (
2121 "sync"
2222 "testing"
23+ "time"
2324
2425 "github.com/apache/pulsar-client-go/pulsar/internal"
2526 "github.com/apache/pulsar-client-go/pulsar/internal/crypto"
@@ -121,14 +122,18 @@ func TestBatchMessageIDWithAckTracker(t *testing.T) {
121122
122123 // ensure the tracker was set on the message id
123124 var messageIDs []* trackingMessageID
124- for i := 0 ; i < 10 ; i ++ {
125+ running := true
126+ for running {
125127 select {
126128 case m := <- pc .queueCh .outCh :
127129 id := m .ID ().(* trackingMessageID )
128130 assert .NotNil (t , id .tracker )
129131 messageIDs = append (messageIDs , id )
130- default :
131- break
132+ if len (messageIDs ) == 10 {
133+ running = false
134+ }
135+ case <- time .After (5 * time .Second ):
136+ running = false
132137 }
133138 }
134139
You can’t perform that action at this time.
0 commit comments