From 387d411bfc3681322b71edf604a8350ac3d0c9bf Mon Sep 17 00:00:00 2001 From: Osvaldo Ortega <48293249+osortega@users.noreply.github.com> Date: Wed, 24 Jan 2024 01:19:18 +0000 Subject: [PATCH] Clear axios timeout after request is done --- ts/src/management/tunnelManagementHttpClient.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ts/src/management/tunnelManagementHttpClient.ts b/ts/src/management/tunnelManagementHttpClient.ts index f0d999dc..16c00689 100644 --- a/ts/src/management/tunnelManagementHttpClient.ts +++ b/ts/src/management/tunnelManagementHttpClient.ts @@ -1090,13 +1090,14 @@ export class TunnelManagementHttpClient implements TunnelManagementClient { let disposable: Disposable | undefined; const abortController = new AbortController(); + let timeOutId: number | undefined; const newAbortSignal = () => { if (cancellation?.isCancellationRequested) { abortController.abort(); } else if (cancellation) { disposable = cancellation.onCancellationRequested(() => abortController.abort()); } else { - setTimeout(() => abortController.abort(), defaultRequestTimeoutMS); + timeOutId = setTimeout(() => abortController.abort(), defaultRequestTimeoutMS); } return abortController.signal; } @@ -1136,6 +1137,8 @@ export class TunnelManagementHttpClient implements TunnelManagementClient { throw requestError; } finally { + // clear abort timeout + clearTimeout(timeOutId); disposable?.dispose(); } }