refactor(all): uniformisation

This commit is contained in:
BlackAngelTV committed 2026-09-23 18:25:28 +02:00
1 parent ee538cb943
commit 50665c8edd
89 files changed
+10215 -10215

No files matched your search

+19 -19
View File
@@ -1,19 +1,19 @@
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
/**
* Retries an async operation with exponential backoff (M13-T05).
* `shouldRetry` decides whether an error is transient.
*/
export async function withRetry(
operation,
{ retries = 2, baseDelayMs = 500, shouldRetry = () => true } = {},
) {
for (let attempt = 0; ; attempt += 1) {
try {
return await operation(attempt);
} catch (error) {
if (attempt >= retries || !shouldRetry(error)) throw error;
await sleep(baseDelayMs * 2 ** attempt);
}
}
}
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
/**
* Retries an async operation with exponential backoff (M13-T05).
* `shouldRetry` decides whether an error is transient.
*/
export async function withRetry(
operation,
{ retries = 2, baseDelayMs = 500, shouldRetry = () => true } = {},
) {
for (let attempt = 0; ; attempt += 1) {
try {
return await operation(attempt);
} catch (error) {
if (attempt >= retries || !shouldRetry(error)) throw error;
await sleep(baseDelayMs * 2 ** attempt);
}
}
}