Skip to content

Commit

Permalink
Make sure we exit the preflight hook if the context is cancelled
Browse files Browse the repository at this point in the history
Signed-off-by: Mihai Todor <[email protected]>
  • Loading branch information
mihaitodor committed Dec 12, 2024
1 parent 72237c4 commit 6a86e78
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/impl/kafka/enterprise/redpanda_migrator_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ func init() {

// Make multiple attempts until the output connects in the background.
// TODO: It would be nicer to somehow get notified when the output is ready.
loop:
for {
if err = kafka.FranzSharedClientUse(outputResource, res, func(details *kafka.FranzSharedClientInfo) error {
for _, topic := range topics {
Expand All @@ -206,7 +207,11 @@ func init() {
break
}

time.Sleep(time.Millisecond * 100)
select {
case <-time.After(100 * time.Millisecond):
case <-ctx.Done():
break loop
}
}
},
func(res *service.Resources) {
Expand Down

0 comments on commit 6a86e78

Please sign in to comment.