-
Notifications
You must be signed in to change notification settings - Fork 148
feat(gateway): configurable fallback timeout for the gateway handler #1079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| // MaxRequestDuration per-request timeout for the gateway handler. It | ||
| // defaults to DefaultMaxRequestDuration. | ||
| MaxRequestDuration time.Duration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be a duration string that can be parsed (e.g. "1h")?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is up to the user of boxo/gateway library.
Prior art (RetrievalTimeout time.Duration) in Kubo is wired in a way that support human-readable strings, but that is userland decision, we dont do that in boxo here.
Added a configurable fallback timeout for the gateway handler, defaulting to 1 hour. Configurable via `MaxRequestDuration` in the gateway config. Replaces #1069
110dc2d to
8e2e90a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #1079 +/- ##
==========================================
- Coverage 61.14% 61.08% -0.06%
==========================================
Files 264 264
Lines 26227 26231 +4
==========================================
- Hits 16036 16024 -12
- Misses 8515 8525 +10
- Partials 1676 1682 +6
... and 11 files with indirect coverage changes 🚀 New features to boost your workflow:
|
- fix typo in error message (MaxRequestDuratio -> MaxRequestDuration) - clarify difference between MaxRequestDuration and RetrievalTimeout - document that zero/negative values use the default
- add unit tests for validateConfig with MaxRequestDuration - add integration test verifying timeout behavior with slow backend - add slowMockBackend that respects context cancellation
exposes the previously hardcoded 1 hour gateway request deadline as a configurable option, allowing operators to adjust it to fit deployment needs. protects gateway from edge cases and slow client attacks. boxo: ipfs/boxo#1079
* feat(config): add Gateway.MaxRequestDuration option exposes the previously hardcoded 1 hour gateway request deadline as a configurable option, allowing operators to adjust it to fit deployment needs. protects gateway from edge cases and slow client attacks. boxo: ipfs/boxo#1079 * test(gateway): add MaxRequestDuration integration test verifies config is wired correctly and 504 is returned when exceeded * docs: add MaxRequestDuration to gateway production guide --------- Co-authored-by: Andrew Gillis <11790789+gammazero@users.noreply.github.com>
Added a configurable fallback timeout for the gateway handler, defaulting to 1 hour. Configurable via
MaxRequestDurationin the gateway config.Replaces #1069