Skip to content

Conversation

@acejam
Copy link
Contributor

@acejam acejam commented Nov 17, 2025

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 acejam requested review from a team and lidel as code owners November 17, 2025 19:33
@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

❌ Patch coverage is 28.57143% with 5 lines in your changes missing coverage. Please review.
✅ 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 ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1069      +/-   ##
==========================================
- Coverage   61.23%   61.20%   -0.03%     
==========================================
  Files         268      268              
  Lines       26284    26290       +6     
==========================================
- Hits        16096    16092       -4     
- Misses       8511     8519       +8     
- Partials     1677     1679       +2     
Files with missing lines Coverage Δ
gateway/handler.go 77.16% <28.57%> (-0.76%) ⬇️

... and 6 files with indirect coverage changes

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant