fix: add safety timeout to session.compact() to prevent lane deadlock (#16533)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 21e4045add
Co-authored-by: BinHPdev <219093083+BinHPdev@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
Bin Deng
2026-02-15 06:54:12 +08:00
committed by GitHub
parent 542271e305
commit c0cd3c3c08
8 changed files with 417 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ export async function withTimeout<T>(
const abortCtrl = new AbortController();
const timeoutError = new Error(`${label ?? "request"} timed out`);
const timer = setTimeout(() => abortCtrl.abort(timeoutError), resolved);
timer.unref?.();
let abortListener: (() => void) | undefined;
const abortPromise: Promise<never> = abortCtrl.signal.aborted