Skip to content

Commit

Permalink
chore: change multi command endstream example to avoid terminating th…
Browse files Browse the repository at this point in the history
…e executor mid-execution
  • Loading branch information
SewerynKras committed Nov 23, 2023
1 parent 884afbd commit 9cd3aa9
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TaskExecutor } from "@golem-sdk/golem-js";
yagnaOptions: { apiKey: "try_golem" },
});

const result = await executor.run(async (ctx) => {
await executor.run(async (ctx) => {
const res = await ctx
.beginBatch()
.uploadFile("./worker.mjs", "/golem/input/worker.mjs")
Expand All @@ -17,6 +17,7 @@ import { TaskExecutor } from "@golem-sdk/golem-js";

res.on("data", (result) => console.log(result));
res.on("error", (error) => console.error(error));
res.on("close", () => executor.shutdown());
return new Promise((resolve) => res.on("close", resolve));
});
await executor.shutdown();
})();

0 comments on commit 9cd3aa9

Please sign in to comment.