Created
March 20, 2013 14:47
-
-
Save odyss009/5205227 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var graceTimeout1 = 1; | |
var graceTimeout10 = 10; | |
var graceTimeout100 = 100; | |
var graceTimeout1000 = 1000; | |
process.on('SIGINT', function() { | |
console.log('SIGINT received'); | |
setTimeout(function() { | |
console.log('Timeout A called after %s ms', graceTimeout1); | |
}, graceTimeout1); | |
setTimeout(function() { | |
console.log('Timeout B called after %s ms', graceTimeout10); | |
}, graceTimeout10); | |
setTimeout(function() { | |
console.log('Timeout C called after %s ms', graceTimeout100); | |
}, graceTimeout100); | |
setTimeout(function() { | |
console.log('Timeout D called after %s ms', graceTimeout1000); | |
}, graceTimeout1000); | |
}); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('Running grace test'); | |
}).listen(1337, '127.0.0.1'); | |
console.log('Grace test running at http://127.0.0.1:1337'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment