Skip to content

Commit

Permalink
fix: Allow partial call failures with allSettled
Browse files Browse the repository at this point in the history
  • Loading branch information
nadeesha committed Nov 29, 2024
1 parent 60cfc76 commit 60ba924
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sdk-node/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,17 @@ export class Service {
});
}

await Promise.all(
const results = await Promise.allSettled(
pollResult.body.map(async (job) => {
await this.processCall(job);
}),
);

if (results.length > 0) {
log("Completed poll iteration", {
results: results.map((r) => r.status),
});
}
}

private async processCall(call: CallMessage): Promise<void> {
Expand Down

0 comments on commit 60ba924

Please sign in to comment.