Skip to content

Commit

Permalink
make sure gateway is closed on ready error
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed Oct 4, 2023
1 parent 6bca87f commit 80ccb75
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gateway/gateway_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ func (g *gatewayImpl) open(ctx context.Context) error {
return ctx.Err()
case err = <-readyChan:
if err != nil {
closeCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
g.Close(closeCtx)
return fmt.Errorf("failed to open gateway connection: %w", err)
}
}
Expand Down

0 comments on commit 80ccb75

Please sign in to comment.