mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 20:16:37 +00:00
Propagate context to upstream request
Propagates the context to upstream requests so that cancellation can cascade. Closes: #1501 by @SpaWn2KiLl which was not signed-off. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
@ -123,7 +123,7 @@ func forwardRequest(w http.ResponseWriter,
|
||||
log.Printf("forwardRequest: %s %s\n", upstreamReq.Host, upstreamReq.URL.String())
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||
ctx, cancel := context.WithTimeout(r.Context(), timeout)
|
||||
defer cancel()
|
||||
|
||||
res, resErr := proxyClient.Do(upstreamReq.WithContext(ctx))
|
||||
|
Reference in New Issue
Block a user