Skip to content

Commit

Permalink
Close channels.
Browse files Browse the repository at this point in the history
  • Loading branch information
markusthoemmes committed Dec 14, 2018
1 parent af60a8c commit 2a2cba5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/queue/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func (h *timeoutHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// The recovery value of a panic is written to this channel to be
// propagated (panicked with) again.
panicChan := make(chan interface{}, 1)
defer close(panicChan)

tw := &timeoutWriter{w: w}
go func() {
Expand All @@ -89,6 +90,7 @@ func (h *timeoutHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
for {
select {
case p := <-panicChan:
close(done)
panic(p)
case <-done:
return
Expand Down

0 comments on commit 2a2cba5

Please sign in to comment.