Skip to content

Instantly share code, notes, and snippets.

@tisba
Created May 3, 2013 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tisba/5511388 to your computer and use it in GitHub Desktop.
Save tisba/5511388 to your computer and use it in GitHub Desktop.
"use strict";
var _ = require("underscore")
, ForeverAgent = require("request/forever");
exports.createKeepAliveAgent = function createKeepAliveAgent() {
var agent = new ForeverAgent();
agent.close = function close() {
var self = this;
_.each(self.sockets, function (value, key) {
self.sockets[key].forEach(function (socket) {
socket.destroy();
});
});
};
agent.minSockets = 1000;
return agent;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment