Skip to content

Commit

Permalink
Merge pull request #1167 from andresaristizabal/wasm/js/fix-crash-on-…
Browse files Browse the repository at this point in the history
…invalid-coproc

Wasm/js/fix crash on invalid coproc
  • Loading branch information
0x5d authored Apr 16, 2021
2 parents b93bd19 + 77748b9 commit 9b587f4
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/js/modules/rpc/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,13 @@ export class ProcessBatchServer extends SupervisorServer {
this.fireException
);

return Promise.allSettled(results).then((coprocessorResults) => {
const array: ProcessBatchReplyItem[][] = [];
coprocessorResults.forEach((result) => {
if (result.status === "rejected") {
console.error(result.reason);
} else {
array.push(result.value);
}
});
return array.flat();
});
return Promise.all(results).then(
(coprocessorResults) => coprocessorResults.flat(),
(e) => {
this.logger.error(e);
return Logging.close().then(() => process.exit(1));
}
);
}

/**
Expand Down

0 comments on commit 9b587f4

Please sign in to comment.