From 60ba924c44077b5654e1b3f056f4c8806fe01531 Mon Sep 17 00:00:00 2001 From: Nadeesha Cabral Date: Fri, 29 Nov 2024 21:22:47 +1100 Subject: [PATCH] fix: Allow partial call failures with allSettled --- sdk-node/src/service.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sdk-node/src/service.ts b/sdk-node/src/service.ts index 151b10d1..274bb5f1 100644 --- a/sdk-node/src/service.ts +++ b/sdk-node/src/service.ts @@ -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 {