Skip to content

Commit

Permalink
fix: error output
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNoim committed Jan 24, 2023
1 parent 3d87e49 commit 65a3672
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions reactive_home/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ for await (const path of walk(flags.root)) {
continue;
}

console.info("Load script", path.path);

const loadWorker = async () => {
while (true) {
console.info("Load script", path.path);

const worker = new Worker(
new URL(join(Deno.cwd(), path.path), import.meta.url).href,
{
Expand All @@ -41,10 +41,11 @@ for await (const path of walk(flags.root)) {
worker.onerror = (error) => {
console.error(
`Terminate worker ${path.path} because of an error. Restart in 5s.`,
error
error.error
);
worker.terminate();
setTimeout(() => {
console.log(`Will now restart ${path.path}`);
resolve(null);
}, 5 * 1000);
};
Expand Down

0 comments on commit 65a3672

Please sign in to comment.