code: func WithWaitGroup(handler http.Handler, longRunning apirequest.LongRunningRequestCheck, wg *utilwaitgroup.SafeWaitGroup) http.Handler {
  	return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
  		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
  			responsewriters.InternalError(w, req, errors.New("no RequestInfo found in the context"))
  			return
  		}
  
  		if !longRunning(req, requestInfo) {
  			if err := wg.Add(1); err != nil {
  				http.Error(w, "apiserver is shutting down.", http.StatusInternalServerError)
  				return
  			}
  			defer wg.Done()
  		}
  
  		handler.ServeHTTP(w, req)
  	})
  }
docs: // WithWaitGroup adds all non long-running requests to wait group, which is used for graceful shutdown.