From 8d1643851cd1c1c9c81099968e7bf6002d0d3780 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 30 Jul 2026 03:36:38 +0530 Subject: [PATCH] refactor: use promisified setTimeout in read retry Co-Authored-By: Claude Fable 5 --- src/node/utils/fs.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node/utils/fs.ts b/src/node/utils/fs.ts index d623a969..c4365ae1 100644 --- a/src/node/utils/fs.ts +++ b/src/node/utils/fs.ts @@ -1,4 +1,5 @@ import { readFile as fsReadFile } from 'node:fs/promises' +import { setTimeout } from 'node:timers/promises' const retryCodes = new Set(['EMFILE', 'ENFILE']) @@ -13,7 +14,7 @@ export async function readFile(file: string): Promise { } catch (e) { const code = (e as NodeJS.ErrnoException).code if (attempt >= 9 || !code || !retryCodes.has(code)) throw e - await new Promise((resolve) => setTimeout(resolve, 2 ** attempt * 10)) + await setTimeout(2 ** attempt * 10) } } }