Skip to content

Commit

Permalink
Catch worker error and restart
Browse files Browse the repository at this point in the history
Closes: #1960
PR-URL: #1961
  • Loading branch information
tshemsedinov committed Feb 11, 2024
1 parent df4c4c4 commit e3c8d49
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions impress.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ const startWorker = async (app, kind, port, id = ++impress.lastWorkerId) => {
}
app.threads.set(id, worker);

worker.on('error', (error) => {
impress.console.error(error.message);
});

worker.on('exit', (code) => {
if (code !== 0) startWorker(app, kind, port, id);
else app.threads.delete(id);
Expand Down

0 comments on commit e3c8d49

Please sign in to comment.