Skip to content

Commit 1330496

Browse files
yorkieFishrock123
authored andcommitted
cluster: remove use of bind() in destroy()
This commit replaces process.exit.bind() with an arrow function in Worker.prototype.destroy(). PR-URL: #6502 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 08e0884 commit 1330496

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎lib/cluster.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,10 +684,12 @@ function workerInit(){
684684

685685
Worker.prototype.destroy=function(){
686686
this.exitedAfterDisconnect=true;
687-
if(!this.isConnected())process.exit(0);
688-
varexit=process.exit.bind(null,0);
689-
send({act: 'exitedAfterDisconnect'},()=>process.disconnect());
690-
process.once('disconnect',exit);
687+
if(!this.isConnected()){
688+
process.exit(0);
689+
}else{
690+
send({act: 'exitedAfterDisconnect'},()=>process.disconnect());
691+
process.once('disconnect',()=>process.exit(0));
692+
}
691693
};
692694

693695
functionsend(message,cb){

0 commit comments

Comments
(0)