Skip to content

Instantly share code, notes, and snippets.

@gjohnson
Created September 30, 2011 05:01
Show Gist options
  • Save gjohnson/1252714 to your computer and use it in GitHub Desktop.
Save gjohnson/1252714 to your computer and use it in GitHub Desktop.
understanding cluster plugins
var utils = require('cluster/lib/utils')
, store = {};
module.exports = function (options) {
options = options || {};
ratelimit.enableInWorker = true;
function ratelimit (master) {
var server = master.server;
utils.unshiftListener(server, 'connection', function (sock) {
sock.pause();
setTimeout(function(){
sock.resume();
}, 25);
});
}
return ratelimit;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment