From a0bac1845e4994a060699068d72b64146f0c88e2 Mon Sep 17 00:00:00 2001 From: Jordan Jennings <1031913+jordanjennings@users.noreply.github.com> Date: Fri, 3 Apr 2026 15:59:03 -0400 Subject: [PATCH] fix: remove abort event listener on successful completion in fetchWithTimeout When an AbortSignal is passed to fetchWithTimeout, the method adds an event listener to forward abort events to the internal controller but never removes it on successful completion. In Deno, this refs the underlying timer of AbortSignal.timeout(), preventing the process from exiting until the full timeout duration elapses. Fixes openai/openai-node#1811 --- src/client.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client.ts b/src/client.ts index f55a6b986..c95ac47fb 100644 --- a/src/client.ts +++ b/src/client.ts @@ -892,6 +892,7 @@ export class OpenAI { return await this.fetch.call(undefined, url, fetchOptions); } finally { clearTimeout(timeout); + if (signal) signal.removeEventListener('abort', abort); } }