From d1598a08033fad38ad4fe022f3f82854d221c196 Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Fri, 19 Dec 2025 14:28:36 -0800 Subject: [PATCH] fix(execution): wait for all block logs to finish --- apps/sim/executor/execution/engine.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/sim/executor/execution/engine.ts b/apps/sim/executor/execution/engine.ts index 10eb0114c0..12979c80b9 100644 --- a/apps/sim/executor/execution/engine.ts +++ b/apps/sim/executor/execution/engine.ts @@ -58,6 +58,8 @@ export class ExecutionEngine { metadata: this.context.metadata, } } catch (error) { + await this.waitForAllExecutionsToSettle() + const endTime = Date.now() this.context.metadata.endTime = new Date(endTime).toISOString() this.context.metadata.duration = endTime - startTime @@ -129,6 +131,12 @@ export class ExecutionEngine { await Promise.all(Array.from(this.executing)) } + private async waitForAllExecutionsToSettle(): Promise { + if (this.executing.size > 0) { + await Promise.allSettled(Array.from(this.executing)) + } + } + private async withQueueLock(fn: () => Promise | T): Promise { const prevLock = this.queueLock let resolveLock: () => void