-
Notifications
You must be signed in to change notification settings - Fork 0
π‘οΈ Sentinel: [MEDIUM] Add timeouts to external fetch calls to prevent server resource exhaustion #43
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import { SNAP, correctedSnapFdv } from "@/lib/snap"; | ||
|
|
||
| export const SNAP_MARKET_REVALIDATE = 30; | ||
| const MARKET_DATA_TIMEOUT_MS = 10_000; | ||
|
|
||
| type DexPeriod = { | ||
| buys?: number; | ||
|
|
@@ -79,6 +80,7 @@ export async function getSnapMarketData(): Promise<SnapMarketResponse> { | |
| "user-agent": "hypersnap.org market data checker", | ||
| }, | ||
| next: { revalidate: SNAP_MARKET_REVALIDATE }, | ||
| signal: AbortSignal.timeout(MARKET_DATA_TIMEOUT_MS), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
After this request has a cached response and the 30s Useful? React with πΒ / π. |
||
| }); | ||
|
|
||
| if (!response.ok) { | ||
|
|
||
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.
Optional GitHub fetches abort sync
Medium Severity
Adding
AbortSignal.timeouttofetchGithubJsonandfetchGithubTextmakes timeouts throw beforeoptionalhandling runs. Callers that passoptional: trueonly degrade on HTTP 404/409; a slow optional doc, tree, or release fetch now fails the entiresync-sourcesrun instead of continuing with empty or partial data like missing resources do.Additional Locations (1)
scripts/sync-sources.mjs#L50-L70Reviewed by Cursor Bugbot for commit 43e213a. Configure here.