Use http server timeout knob in local_backend instead of hard-coded value #284
+13
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Main motivation: Allow self-hosted instances to configure the maximum duration for long-running HTTP requests (notably file uploads).
This PR makes the local backend’s HTTP request timeout configurable via
HTTP_SERVER_TIMEOUT_SECONDSby standardizing on the sharedHTTP_SERVER_TIMEOUT_DURATIONknob.Changes
HTTP_SERVER_TIMEOUT_DURATIONinto both HTTP servers started by local-backend:main.rsproxy.rsknobs.rsso the knob matches the prior local-backend hardcoded behavior (i.e. no default behavior change for local backend unless the env var is set).HTTP_SERVER_TIMEOUT_SECONDSin self-hosted Docker Compose so operators can override it.Behavior
This timeout is enforced by
tower_http::timeout::TimeoutLayer, so it bounds end-to-end request processing time (including time spent receiving an upload body). Requests exceeding the duration will return "408 Request Timeout".Increasing
HTTP_SERVER_TIMEOUT_SECONDSincreases the maximum allowed duration for uploads to/api/storage/uploadand any long-running HTTP Action requests going through the local backend/proxy.Testing
Manual verification: start the backend with a low/high
HTTP_SERVER_TIMEOUT_SECONDSand confirm long uploads fail/succeed accordingly. (I have verified this using a local build of the backend container.)By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.