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 2d031d2
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 @@ -146,6 +146,9 @@ func (g *gatewayImpl) open(ctx context.Context) error {
g.Close(closeCtx)
return ctx.Err()
case err = <-readyChan:
closeCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
g.Close(closeCtx)
if err != nil {
return fmt.Errorf("failed to open gateway connection: %w", err)
}
Expand Down

0 comments on commit 2d031d2

Please sign in to comment.