Timer unref ref in nodejs

Timers Unref, Ref in nodejs

If there is no other activity keeping the event loop running, the process may exit before the Timeout object's callback is invoked when Calling timeout.unref()


var timeout = setTimeout(function() {
console.log('setTimeout')
}, 10000);

var interval = setInterval(function(){
console.log("exectute every 10 secs")
}, 5000)

After unref application will stop when other than this setInterval, nothing is running in eventloop
interval.unref();

If I not ref again application will stop because other than this setInterval nothing is running in eventloop
interval.ref();



/**

*/

Comments

Popular posts from this blog

Proxy setting in java

Using logstash to import csv json files into elasticsearch

Kibana 4 Installation and Run as a service in ubuntu