Skip to content

Instantly share code, notes, and snippets.

@calibr
Created October 29, 2015 15:36
Show Gist options
  • Select an option

  • Save calibr/5986170d37081dce5f46 to your computer and use it in GitHub Desktop.

Select an option

Save calibr/5986170d37081dce5f46 to your computer and use it in GitHub Desktop.
var http = require("http");
var domain = require("domain");
function log() {
var args = [].slice.call(arguments);
args.unshift(process.uptime()+"s:");
console.log.apply(console, args);
}
var agent = new http.Agent({
keepAlive: true,
keepAliveMsecs: 10000
});
var req = http.request({
hostname: "extranet.newtonideas.com",
port: 80,
path: "/",
method: "GET",
agent: agent
}, function(res) {
res.on("data", function() {
});
res.on("end", function() {
log("Complete");
});
});
req.on("socket", function(sock) {
sock.on("close", function() {
log("socket closed");
});
});
req.on("error", function(err) {
log("an error ocurred", err);
});
process.on('uncaughtException', function(err) {
log("uncaughtException");
console.error(err.stack);
process.exit();
});
req.end();
setTimeout(function() {
log("done");
}, 300000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment