From 77e0c61279b3b50a29f7deb9686ee185836c89df Mon Sep 17 00:00:00 2001 From: Mauricio Schneider Date: Tue, 17 Mar 2015 10:16:51 -0300 Subject: [PATCH] CP: Schedule request before handling possible request errors. Fix #101 --- lib/agent/plugins/control-panel/interval/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/agent/plugins/control-panel/interval/index.js b/lib/agent/plugins/control-panel/interval/index.js index 3dc583e49..8bceb541d 100644 --- a/lib/agent/plugins/control-panel/interval/index.js +++ b/lib/agent/plugins/control-panel/interval/index.js @@ -32,6 +32,8 @@ var request = function() { getter.commands(function(err, resp) { requesting = false; + schedule_request(); + if (err) return hooks.trigger('error', err, 'interval'); else if (resp.statusCode != 200) @@ -47,7 +49,6 @@ var request = function() { if (cmd) emitter.emit('command', cmd); }); - schedule_request(); }); };