π‘οΈ Sentinel: [ENHANCEMENT] Add timeout to external API calls - #41
π‘οΈ Sentinel: [ENHANCEMENT] Add timeout to external API calls#41felirami wants to merge 1 commit into
Conversation
Co-authored-by: felirami <6752178+felirami@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
CodeAnt AI is reviewing your PR. |
Thanks for using CodeAnt! πWe're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X Β· |
|
CodeAnt AI finished reviewing your PR. |
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7e0b6ed7d8
βΉοΈ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| headers: { | ||
| Accept: "application/json", | ||
| }, | ||
| signal: AbortSignal.timeout(NODE_PROBE_TIMEOUT_MS), |
There was a problem hiding this comment.
Preserve memoization for repeated status probes
On /network, NetworkPage awaits getNetworkStatus() before rendering NetworkStatusGrid, which calls getNetworkStatus() again; on a cache miss/revalidation with a slow public node, adding a fresh signal here opts the server fetch out of Next request memoization (Next fetch docs). That makes the route wait for one 10s probe and then start another 10s probe instead of sharing the first result, so the degraded page can take ~20s or exceed serverless budgets; consider passing the first status into the grid or wrapping the status lookup in an explicit cache.
Useful? React with πΒ / π.
User description
π¨ Severity: ENHANCEMENT
π‘ Vulnerability: Missing timeouts on external
fetchcalls, which can cause resource exhaustion or hanging processes if external services are down or unresponsive.π― Impact: Prevents potential DoS or hanging build processes caused by hanging network requests.
π§ Fix: Added
signal: AbortSignal.timeout(10_000)tofetchcalls insrc/lib/network.ts,src/lib/snap-market.ts, andscripts/sync-sources.mjs.β Verification: Ran
npm run lint,npm run typecheck, andnpm run buildto ensure the build and code verifications pass.PR created automatically by Jules for task 418629655227238592 started by @felirami
Note
Low Risk
Small, defensive networking change with no auth or data-model impact; worst case is earlier failures when external APIs are slow.
Overview
Adds 10-second
AbortSignal.timeouton outboundfetchcalls so slow or stuck third-party APIs cannot hang builds or server work indefinitely.scripts/sync-sources.mjsdefinesFETCH_TIMEOUT_MSand applies it to GitHub JSON and raw text helpers used during source sync.src/lib/network.tswires the existingNODE_PROBE_TIMEOUT_MSinto the public node info probe ingetNetworkStatus.src/lib/snap-market.tsexportsFETCH_TIMEOUT_MSand uses it for the Dexscreener market fetch ingetSnapMarketData.Failures surface through existing error handling (e.g. network status and market responses) rather than open-ended waits.
Reviewed by Cursor Bugbot for commit 7e0b6ed. Bugbot is set up for automated code reviews on this repo. Configure here.
CodeAnt-AI Description
Add timeouts to external API requests
What Changed
Impact
β Fewer hung sync jobsβ Faster failure when third-party APIs are downβ Reduced build and server waits on slow network callsπ‘ Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.
Note
Add 10-second abort timeouts to external API fetch calls
Adds
AbortSignal.timeout(10000)to fetch calls in three modules: GitHub sync utilities in sync-sources.mjs, the node info probe in network.ts, and the market data fetch in snap-market.ts. Timed-out requests throw and flow into existing error-handling paths, returningok=falsewhere applicable. Behavioral Change: requests that previously hung indefinitely will now fail after 10 seconds.Macroscope summarized 7e0b6ed.