Skip to content

Commit

Permalink
change revision timeout to be max duration of a request
Browse files Browse the repository at this point in the history
  • Loading branch information
izabelacg committed May 9, 2024
1 parent cede1ec commit e304adc
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions pkg/http/handler/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ func (h *timeoutHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
return
case <-timeout.C():
timeoutDrained = true
if tw.tryTimeoutAndWriteError(h.body) {
timedOut := tw.tryTimeoutAndWriteError(h.body)
if timedOut {
timeoutDrained = true
return
}
case now := <-idleTimeoutCh:
Expand Down Expand Up @@ -224,12 +225,8 @@ func (tw *timeoutWriter) tryTimeoutAndWriteError(msg string) bool {
tw.mu.Lock()
defer tw.mu.Unlock()

if tw.lastWriteTime.IsZero() {
tw.timeoutAndWriteError(msg)
return true
}

return false
tw.timeoutAndWriteError(msg)
return true
}

// tryResponseStartTimeoutAndWriteError writes an error to the responsewriter if
Expand Down

0 comments on commit e304adc

Please sign in to comment.