Skip to content

Commit

Permalink
Shorten timeout for unhandled error to 1 second
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Liggitt <liggitt@google.com>
  • Loading branch information
liggitt committed Jun 28, 2024
1 parent ad82e28 commit 3f1023d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,15 @@ func (s *Connection) shutdown(closeTimeout time.Duration) {
}

if err != nil {
duration := 10 * time.Minute
// default to 1 second
duration := time.Second
// if a closeTimeout was given, use that, clipped to 1s-10m
if closeTimeout > time.Second {
duration = closeTimeout
}
if duration > 10*time.Minute {
duration = 10 * time.Minute
}
timer := time.NewTimer(duration)
defer timer.Stop()
select {
Expand Down

0 comments on commit 3f1023d

Please sign in to comment.