Skip to content

Commit 51f2578

Browse files
Flush early context run (#591)
1 parent 8122a0b commit 51f2578

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/restate-sdk/src/promises.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,10 @@ export class PromisesExecutor {
442442
restatePromise.tryCancel();
443443
return;
444444
} else {
445+
// If we're in this branch, there might be a ctx.run command waiting to be flushed
446+
// Let's flush it to notify early the runtime we're gonna run a ctx.run
447+
await this.outputPump.awaitNextProgress();
448+
445449
// We need to execute a run closure
446450
this.runClosuresTracker.executeRun(doProgressResult.ExecuteRun);
447451
// Let the run context switch, then come back to this flow.

0 commit comments

Comments
 (0)