Просмотр исходного кода

fix: clear timeout after promise rejection (#24864)

Luke Parker 4 месяцев назад
Родитель
Сommit
9fbeafb63e
1 измененных файлов с 1 добавлено и 2 удалено
  1. 1 2
      packages/opencode/src/util/timeout.ts

+ 1 - 2
packages/opencode/src/util/timeout.ts

@@ -1,9 +1,8 @@
 export function withTimeout<T>(promise: Promise<T>, ms: number): Promise<T> {
   let timeout: NodeJS.Timeout
   return Promise.race([
-    promise.then((result) => {
+    promise.finally(() => {
       clearTimeout(timeout)
-      return result
     }),
     new Promise<never>((_, reject) => {
       timeout = setTimeout(() => {