mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Refactor: drop Bun.nanoseconds & Bun.sleep
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import retry from 'async-retry';
|
||||
import picocolors from 'picocolors';
|
||||
import { setTimeout } from 'timers/promises';
|
||||
|
||||
// retry settings
|
||||
const MIN_TIMEOUT = 10;
|
||||
@@ -84,7 +85,7 @@ function createFetchRetry($fetch: typeof fetch): FetchWithRetry {
|
||||
if (retryAfter > retryOpts.maxRetryAfter) {
|
||||
return res;
|
||||
}
|
||||
await Bun.sleep(retryAfter * 1e3);
|
||||
await setTimeout(retryAfter * 1e3, undefined, { ref: false });
|
||||
}
|
||||
}
|
||||
throw new ResponseError(res);
|
||||
|
||||
Reference in New Issue
Block a user