Skip to content

Commit 6c34646

Browse files
committed
Address comment
1 parent e6a540d commit 6c34646

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

pulsar/blue_green_migration_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,12 @@ func testTopicMigrate(
164164
retryStarted := time.Now()
165165

166166
for true {
167-
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
168-
_, err := producer.Send(ctx, &pm)
169-
cancel()
167+
err := func() error {
168+
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
169+
defer cancel()
170+
_, err := producer.Send(ctx, &pm)
171+
return err
172+
}
170173
if err == nil {
171174
break
172175
}

0 commit comments

Comments
 (0)