Skip to content

Commit

Permalink
bug fix for missing terminate function on dsuWorker in iframeHandler …
Browse files Browse the repository at this point in the history
…middleware
  • Loading branch information
asaccool committed Jan 15, 2021
1 parent c842900 commit c83fd33
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions middlewares/iframeHandler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ function IframeHandler(server) {
if (code !== 0) {
console.log(`Worker stopped with exit code ${code}`);
// remove the worker from list in order to be recreated when needed
dsuWorkers[seed] = null;
delete dsuWorkers[seed];
}
});

dsuWorker.terminate = function(){
worker.terminate();
}
});
}),
};
Expand All @@ -105,9 +109,8 @@ function IframeHandler(server) {
console.log(`Stopping a number of ${Object.keys(dsuWorkers).length} thread workers`);
for(let seed in dsuWorkers){
let worker = dsuWorkers[seed];
if(typeof worker !== "undefined"){
if(worker && worker.terminate){
worker.terminate();
delete dsuWorkers[seed];
}
}
}
Expand Down

0 comments on commit c83fd33

Please sign in to comment.