add async helper functions - #242
Conversation
|
Deployment failed with the following error: Learn More: https://vercel.com/born-slippys-projects?upgradeToPro=build-rate-limit |
| export function withRetry<T>(fn: () => Promise<T>, opts = DEFAULTS): Promise<T> { | ||
| let lastError: unknown; | ||
| for (let i = 0; i < opts.retries; i++) { | ||
| try { |
There was a problem hiding this comment.
CRITICAL: withRetry never awaits fn(), so it does not actually retry async work.
Because fn is typed () => Promise<T>, calling fn() returns a promise that is returned immediately on the first iteration. The try/catch only intercepts synchronous throws; a rejected promise is never caught, so the retry loop never executes and the returned promise rejects on the first failure. It must await fn() inside the loop.
| try { | |
| return await fn(); |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| } as const; | ||
|
|
||
| export function withRetry<T>(fn: () => Promise<T>, opts = DEFAULTS): Promise<T> { | ||
| let lastError: unknown; |
There was a problem hiding this comment.
WARNING: Retry loop runs without any delay between attempts.
Even after fixing the missing await, consecutive retries fire back-to-back with no backoff. For network or transient failures this hammers the dependency and can worsen outages. Consider an exponential backoff, with optional jitter, between iterations.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| @@ -0,0 +1,9 @@ | |||
| export async function fetchWithTimeout(url: string, ms: number): Promise<Response> { | |||
There was a problem hiding this comment.
WARNING: This file is a byte-for-byte duplicate of sanitizers_extract_constant.ts (identical fetchWithTimeout).
Two files exporting the same function invite divergent edits and confuse consumers about which to import. The filename sanitizers_improve_logging.ts also does not match its content, since it contains a fetch helper rather than logging. Delete the duplicate and keep a single canonical file with a name reflecting its purpose.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
Files Reviewed (3 files)
Fix these issues in Kilo Cloud Reviewed by hy3-20260706:free · Input: 34.1K · Output: 3.2K · Cached: 99.5K |
Auto-generated: add async helper functions
Project: mercato