code: func WithTimeoutForNonLongRunningRequests(handler http.Handler, longRunning apirequest.LongRunningRequestCheck, timeout time.Duration) http.Handler {
  	if longRunning == nil {
  		return handler
  	}
  	timeoutFunc := func(req *http.Request) (*http.Request, <-chan time.Time, func(), *apierrors.StatusError) {
  		// TODO unify this with apiserver.MaxInFlightLimit
  		ctx := req.Context()
  
  		requestInfo, ok := apirequest.RequestInfoFrom(ctx)
  		if !ok {
  			// if this happens, the handler chain isn't setup correctly because there is no request info
  			return req, time.After(timeout), func() {}, apierrors.NewInternalError(fmt.Errorf("no request info found for request during timeout"))
  		}
  
  		if longRunning(req, requestInfo) {
  			return req, nil, nil, nil
  		}
  
  		ctx, cancel := context.WithCancel(ctx)
  		req = req.WithContext(ctx)
  
  		postTimeoutFn := func() {
  			cancel()
  			metrics.Record(req, requestInfo, metrics.APIServerComponent, "", http.StatusGatewayTimeout, 0, 0)
  		}
  		return req, time.After(timeout), postTimeoutFn, apierrors.NewTimeoutError(fmt.Sprintf("request did not complete within %s", timeout), 0)
  	}
  	return WithTimeout(handler, timeoutFunc)
  }
docs: // WithTimeoutForNonLongRunningRequests times out non-long-running requests after the time given by timeout.