diff --git a/lib/sync.js b/lib/sync.js index e7d1640b9..95ce30f79 100644 --- a/lib/sync.js +++ b/lib/sync.js @@ -667,9 +667,9 @@ SyncApi.prototype._pokeKeepAlive = function() { // We wait a short time though, just in case somehow the server // is in a mode where it 400s /versions responses and sync etc. // responses fail, this will mean we don't hammer in a loop. - setTimeout(success, 2000); + self._keepAliveTimer = setTimeout(success, 2000); } else { - setTimeout( + self._keepAliveTimer = setTimeout( self._pokeKeepAlive.bind(self), 5000 + Math.floor(Math.random() * 5000) );