Skip to content

Commit

Permalink
chore(utils/httpbin): ensure timer is always stopped in /delay endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatczuk committed Jul 26, 2024
1 parent c376e2a commit 60c8276
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions utils/httpbin/httpbin.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ func delayHandler(w http.ResponseWriter, r *http.Request) {
}

t := time.NewTimer(time.Duration(ms) * time.Millisecond)
defer t.Stop()

select {
case <-r.Context().Done():
t.Stop()
Expand Down

0 comments on commit 60c8276

Please sign in to comment.