Free-Way icon indicating copy to clipboard operation
Free-Way copied to clipboard

[help wanted] Add timeout support for provider requests

Open GoDiao opened this issue 7 months ago • 2 comments

Summary

Add timeout support for outbound provider requests so one slow or hanging provider does not block Freeway indefinitely.

Background

Provider calls currently use fetch() without an explicit timeout. Free-tier providers can sometimes hang or respond very slowly, and Freeway should be able to fail fast and fall back to another provider.

Relevant files:

  • src/providers/base.ts
  • src/health.ts
  • possibly provider-specific adapters

Requirements

  • [ ] Add an AbortController timeout around provider fetch() calls.
  • [ ] Use a sensible default timeout, or support an env var such as FREEWAY_PROVIDER_TIMEOUT_MS.
  • [ ] Ensure router fallback still works when a provider times out.
  • [ ] Ensure health checks mark timed-out providers as unhealthy.

Acceptance Criteria

  • [ ] A timed-out provider does not hang the whole request indefinitely.
  • [ ] Timeout errors are clear enough for troubleshooting.
  • [ ] Fallback behavior is preserved.
  • [ ] npm run build passes.

Notes for Contributors

Please keep the first PR focused on timeout behavior. Broader retry/circuit-breaker logic can be handled separately.

GoDiao avatar May 02 '26 14:05 GoDiao

Hi! I’d like to help with this issue :))

It looks like a good contribution to understand how provider request handling works in the project. Could you please assign it to me?

Thanks!

Flames4fun avatar May 04 '26 19:05 Flames4fun

Assigned to you @Flames4fun! Looking forward to your PR.

GoDiao avatar May 05 '26 01:05 GoDiao