fix(api): propagate request context to stop processing on client disconnect

This commit is contained in:
Adam Romanek
2026-01-23 11:29:47 +01:00
committed by Julien Neuhart
parent 3220ca4140
commit e14cab0c8b
2 changed files with 72 additions and 1 deletions

View File

@@ -87,7 +87,7 @@ type downloadFrom struct {
// newContext returns a [Context] by parsing a "multipart/form-data" request.
func newContext(echoCtx echo.Context, logger *zap.Logger, fs *gotenberg.FileSystem, timeout time.Duration, bodyLimit int64, downloadFromCfg downloadFromConfig, traceHeader, trace string) (*Context, context.CancelFunc, error) {
processCtx, processCancel := context.WithTimeout(context.Background(), timeout)
processCtx, processCancel := context.WithTimeout(echoCtx.Request().Context(), timeout)
// We want to make sure the multipart/form-data does not exceed a given
// limit. We consider: form fields (keys, values, files) and files