Skip to content

Commit

Permalink
chore: change endstream chunks example to avoid terminating the execu…
Browse files Browse the repository at this point in the history
…tor mid-execution
  • Loading branch information
SewerynKras committed Nov 23, 2023
1 parent 973c706 commit 884afbd
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", (data) => (data.index == 2 ? console.log(data.stdout) : ""));
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 884afbd

Please sign in to comment.