Skip to content

Commit 24e16b6

Browse files
committed
Fix waitForStreams async executor
1 parent 873fd5d commit 24e16b6

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/trigger-sdk/src/v3/streams.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -610,11 +610,13 @@ function writerInternal<TPart>(key: string, options: WriterStreamOptions<TPart>)
610610
console.error(error);
611611
}
612612

613-
const waitForStreams: Promise<void> = new Promise(async (resolve) => {
614-
while (ongoingStreamPromises.length > 0) {
615-
await ongoingStreamPromises.shift();
616-
}
617-
resolve();
613+
const waitForStreams: Promise<void> = new Promise((resolve, reject) => {
614+
(async () => {
615+
while (ongoingStreamPromises.length > 0) {
616+
await ongoingStreamPromises.shift();
617+
}
618+
resolve();
619+
})().catch(reject);
618620
});
619621

620622
waitForStreams.finally(() => {

0 commit comments

Comments
 (0)