From 68edf6919ef9855078a90e8ebe95b7653f30aeeb Mon Sep 17 00:00:00 2001 From: Nicolas Mouso Date: Thu, 28 May 2026 20:22:44 -0300 Subject: [PATCH] fix --- ccip-cli/src/index.ts | 2 +- ccip-sdk/src/api/index.ts | 2 +- ccip-sdk/src/ton/logs.ts | 31 ++++++++++++++++++++++--------- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/ccip-cli/src/index.ts b/ccip-cli/src/index.ts index 97ba39eb..03bb19de 100755 --- a/ccip-cli/src/index.ts +++ b/ccip-cli/src/index.ts @@ -28,7 +28,7 @@ Error.stackTraceLimit = 50 // show more stack frames for better debugging // generate:nofail // `const VERSION = '${require('./package.json').version}-${require('child_process').execSync('git rev-parse --short HEAD').toString().trim()}'` -const VERSION = '1.7.1-90c0438' +const VERSION = '1.7.1-2807dab' // generate:end const require = createRequire(import.meta.url) diff --git a/ccip-sdk/src/api/index.ts b/ccip-sdk/src/api/index.ts index a8186e28..36ffd118 100644 --- a/ccip-sdk/src/api/index.ts +++ b/ccip-sdk/src/api/index.ts @@ -58,7 +58,7 @@ export const DEFAULT_TIMEOUT_MS = 30000 /** SDK version string for telemetry header */ // generate:nofail // `export const SDK_VERSION = '${require('./package.json').version}-${require('child_process').execSync('git rev-parse --short HEAD').toString().trim()}'` -export const SDK_VERSION = '1.7.1-90c0438' +export const SDK_VERSION = '1.7.1-2807dab' // generate:end /** SDK telemetry header name */ diff --git a/ccip-sdk/src/ton/logs.ts b/ccip-sdk/src/ton/logs.ts index 30949419..7dab1436 100644 --- a/ccip-sdk/src/ton/logs.ts +++ b/ccip-sdk/src/ton/logs.ts @@ -61,17 +61,30 @@ async function* fetchTxsForward( yield tx } - let delay$ = AbortSignal.timeout( - Math.max( - Math.ceil((opts.pollInterval || DEFAULT_POLL_INTERVAL) - (performance.now() - lastReq)), - 1, - ), + const delay = Math.max( + Math.ceil((opts.pollInterval || DEFAULT_POLL_INTERVAL) - (performance.now() - lastReq)), + 1, ) - if (opts.watch instanceof AbortSignal) { - if (opts.watch.aborted) break - delay$ = AbortSignal.any([opts.watch, delay$]) + + if (opts.watch instanceof AbortSignal && opts.watch.aborted) { + break } - await signalToPromise(delay$).catch(() => false) + + // NOTE: + // We intentionally avoid `AbortSignal.timeout()` here because Node.js + // implements it using an unref'd timer internally. Unref'd timers do not + // keep the event loop alive, which caused the process to exit while this + // polling loop was awaiting the delay between requests. + // + // Using a normal `setTimeout()` keeps the polling loop alive correctly, + // while `signalToPromise(opts.watch)` still allows immediate cancellation + // when the external AbortSignal is aborted. + await Promise.race([ + new Promise((resolve) => setTimeout(resolve, delay)), + opts.watch instanceof AbortSignal + ? signalToPromise(opts.watch).catch(() => false) + : undefined, + ]) } }