From 3840bbb2bfdd63ca8184df8afa8f37ff216ce4bc Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Mon, 23 Mar 2015 11:10:26 +0100 Subject: [PATCH] Check updates in interval rather than depend on the update function to always setup the timer Fixes #286 --- src/updater.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/updater.js b/src/updater.js index 715f5729b..66171974f 100644 --- a/src/updater.js +++ b/src/updater.js @@ -26,7 +26,7 @@ var appdb = require('./appdb.js'), var INSTALLER_UPDATE_URL = 'http://127.0.0.1:2020/api/v1/installer/update'; -var gCheckUpdatesTimeoutId = null, +var gCheckUpdatesIntervalId = null, gAppUpdateInfo = null, gBoxUpdateInfo = null; @@ -108,7 +108,7 @@ function checkUpdates() { gBoxUpdateInfo = result; - gCheckUpdatesTimeoutId = setTimeout(checkUpdates, 60 * 1000); + // Done we call this in an interval }); }); } @@ -117,15 +117,15 @@ function initialize(callback) { assert(typeof callback === 'function'); progress.clear(progress.UPDATE); - gCheckUpdatesTimeoutId = setTimeout(checkUpdates, 10 * 1000); + gCheckUpdatesIntervalId = setInterval(checkUpdates, 10 * 1000); callback(null); } function uninitialize(callback) { assert(typeof callback === 'function'); - clearTimeout(gCheckUpdatesTimeoutId); - gCheckUpdatesTimeoutId = null; + clearInterval(gCheckUpdatesIntervalId); + gCheckUpdatesIntervalId = null; callback(null); }