From b32520b1f90531d9dcfa74d458911a1d0d232c15 Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Sat, 13 Sep 2014 05:52:03 +0100 Subject: [PATCH] Add a 500ms between network connections, to prevent hitting operating system rate limiting. --- src/client.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/client.js b/src/client.js index 3b7e989..faacbc3 100644 --- a/src/client.js +++ b/src/client.js @@ -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; }); } }