Move longrunning predicate into Config instead of RE

... in order to be available for custom handler chains.
This commit is contained in:
Dr. Stefan Schimanski
2016-09-26 11:25:02 +02:00
parent b806116e40
commit 157dcda8cc
2 changed files with 14 additions and 10 deletions

View File

@@ -35,6 +35,9 @@ var errConnKilled = fmt.Errorf("kill connection/stream")
// WithTimeoutForNonLongRunningRequests times out non-long-running requests after the time given by globalTimeout.
func WithTimeoutForNonLongRunningRequests(handler http.Handler, longRunning LongRunningRequestCheck) http.Handler {
if longRunning == nil {
return handler
}
timeoutFunc := func(req *http.Request) (<-chan time.Time, string) {
// TODO unify this with apiserver.MaxInFlightLimit
if longRunning(req) {