feat(#417): add fetchWithRetry with exponential backoff for auth
Retries network and server errors up to 3 times with exponential backoff (1s, 2s, 4s). Non-retryable errors fail immediately. Refs #417
This commit is contained in:
9
apps/web/src/lib/auth/sleep.ts
Normal file
9
apps/web/src/lib/auth/sleep.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Wait for the specified number of milliseconds.
|
||||
*
|
||||
* Extracted to a separate module to enable clean test mocking
|
||||
* without fake timers.
|
||||
*/
|
||||
export function sleep(ms: number): Promise<void> {
|
||||
return new Promise<void>((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
Reference in New Issue
Block a user