From 74f7415f843579ce4d3d709fd726a0e5ee34f086 Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Tue, 10 Feb 2015 18:21:53 +0100 Subject: [PATCH] Minor changes. --- packages/xo-lib/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/xo-lib/index.js b/packages/xo-lib/index.js index b50b1a1e5..0ffae890b 100644 --- a/packages/xo-lib/index.js +++ b/packages/xo-lib/index.js @@ -254,9 +254,9 @@ function Xo(opts) { function tryConnect() { /* jshint validthis: true */ - this.status = 'connecting'; return this._api.connect().bind(this).catch(function () { - return Bluebird.delay(this._backOff.next().value).then(tryConnect); + var delay = this._backOff.next().value; + return Bluebird.delay(delay).bind(this).then(tryConnect); }); } @@ -290,6 +290,7 @@ Xo.prototype.connect = function () { return this._connection; } + this.status = 'connecting'; this._connection = tryConnect.call(this).then( onSuccessfulConnection, onFailedConnection );