Add a 500ms between network connections, to prevent hitting operating system rate limiting.

This commit is contained in:
Chris Moeller 2014-09-13 05:52:03 +01:00
parent 6bcbe1b702
commit b32520b1f9
1 changed files with 8 additions and 1 deletions

View File

@ -54,8 +54,15 @@ function Client(sockets, config) {
});
if (config) {
var client = this;
var wait_total = 0;
_.each(config.networks || [], function(n) {
client.connect(n);
if (wait_total == 0)
client.connect(n);
else
setTimeout(function() {
client.connect(n);
}, wait_total);
wait_total += 500;
});
}
}