Skip to content

Commit 2892efa

Browse files
authored
Fix: actually wait for realtime streams to finished (#1520)
* Realtime streams fix waiting for streams to finished * Add changeset
1 parent 979ba51 commit 2892efa

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/thirty-moose-jam.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
---
4+
5+
Fix for waiting for realtime streams to finish

packages/core/src/v3/runMetadata/manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ export class StandardMetadataManager implements RunMetadataManager {
250250
return streamInstance;
251251
} catch (error) {
252252
// Clean up metadata key if stream creation fails
253-
this.deleteKey(`$$stream.${key}`);
253+
this.removeFromKey(`$$streams`, key);
254254
throw error;
255255
}
256256
}
@@ -265,7 +265,7 @@ export class StandardMetadataManager implements RunMetadataManager {
265265
return;
266266
}
267267

268-
const promises = Array.from(this.activeStreams.values());
268+
const promises = Array.from(this.activeStreams.values()).map((stream) => stream.wait());
269269

270270
try {
271271
await Promise.race([

0 commit comments

Comments
 (0)