Skip to content

Add configurable request timeout to ApiClient - #406

Merged
DeFiVC merged 2 commits into
ChainLearnOfficial:mainfrom
CollinsKRO:fix/add-api-request-timeout
Sep 2, 2026
Merged

Add configurable request timeout to ApiClient#406
DeFiVC merged 2 commits into
ChainLearnOfficial:mainfrom
CollinsKRO:fix/add-api-request-timeout

Conversation

@CollinsKRO

Copy link
Copy Markdown
Contributor

Summary

Adds a configurable request timeout to ApiClient to prevent indefinitely hanging requests.

Changes

  • Default timeout: Increased from 15s → 30s
  • Configurable per-request: New timeout parameter on get(), post(), put(), delete() methods
  • Mechanism: AbortController + setTimeout (unchanged pattern, now parameterized)
  • Error handling: Existing ApiError with code "TIMEOUT" continues to surface timeouts gracefully

Acceptance Criteria

  • ✅ Requests timeout after 30s
  • ✅ Timeout is configurable per-request
  • ✅ Timeout errors handled gracefully
  • ✅ No hanging requests

Technical Details

src/lib/api/client.tsApiClient class only. All existing callers are unaffected (new params are optional with the same defaults).

Closes #301

…ficial#301)

Increase default timeout from 15s to 30s and make it configurable
per-request via a new timeout parameter on get/post/put/delete methods.
Uses AbortController with setTimeout to prevent hanging requests.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Sep 2, 2026

Copy link
Copy Markdown

@CollinsKRO Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@netlify

netlify Bot commented Sep 2, 2026

Copy link
Copy Markdown

Deploy Preview for chainlearn failed.

Name Link
🔨 Latest commit 3fc19d6
🔍 Latest deploy log https://app.netlify.com/projects/chainlearn/deploys/6a97bf2a61db0c000810ef7c

@DeFiVC
DeFiVC merged commit 58415f9 into ChainLearnOfficial:main Sep 2, 2026
0 of 4 checks passed
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.

. Add api/client.ts request timeout

2 participants