Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ts/src/management/tunnelManagementHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -1136,6 +1137,8 @@ export class TunnelManagementHttpClient implements TunnelManagementClient {

throw requestError;
} finally {
// clear abort timeout
clearTimeout(timeOutId);
disposable?.dispose();
}
}
Expand Down