boxo icon indicating copy to clipboard operation
boxo copied to clipboard

feat(gateway): add configurable fallback timeout for the gateway handler

Open acejam opened this issue 5 months ago • 1 comments

This PR adds a configurable fallback request timeout to the Gateway handler.

  • Introduces fallbackRequestTimeout (default 1h) used in handler.ServeHTTP instead of a hardcoded time.Hour
  • Reads optional env var BOXO_GATEWAY_REQUEST_TIMEOUT at init (Go duration format: "90m", "2h", "5400s")
  • Logs a warning and keeps default if the env value is invalid or non-positive
  • Purpose: prevent long CAR streams or large responses from being truncated at exactly 1 hour due to a hardcoded context deadline

Impact

  • Default behavior remains 1 hour unless BOXO_GATEWAY_REQUEST_TIMEOUT is set
  • Allows deployments to extend or disable (by setting a very large duration) the hard per-request cap independent of RetrievalTimeout

Usage

# Example: raise fallback request timeout to 3 hours
export BOXO_GATEWAY_REQUEST_TIMEOUT="3h"

acejam avatar Nov 17 '25 19:11 acejam

Codecov Report

:x: Patch coverage is 28.57143% with 5 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 61.20%. Comparing base (e71f50e) to head (6ad03bd).

Files with missing lines Patch % Lines
gateway/handler.go 28.57% 4 Missing and 1 partial :warning:

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1069      +/-   ##
==========================================
- Coverage   61.25%   61.20%   -0.05%     
==========================================
  Files         268      268              
  Lines       26284    26290       +6     
==========================================
- Hits        16100    16092       -8     
- Misses       8507     8519      +12     
- Partials     1677     1679       +2     
Files with missing lines Coverage Δ
gateway/handler.go 77.16% <28.57%> (-0.76%) :arrow_down:

... and 8 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Nov 17 '25 19:11 codecov[bot]