diff --git a/src/cron.js b/src/cron.js index c37946442..8f62a1e53 100644 --- a/src/cron.js +++ b/src/cron.js @@ -140,7 +140,7 @@ function recreateJobs(tz) { if (gJobs.boxUpdateCheckerJob) gJobs.boxUpdateCheckerJob.stop(); gJobs.boxUpdateCheckerJob = new CronJob({ cronTime: '00 ' + randomMinute + ' * * * *', // once an hour - onTick: updateChecker.checkBoxUpdates, + onTick: () => updateChecker.checkBoxUpdates(NOOP_CALLBACK), start: true, timeZone: tz }); @@ -148,7 +148,7 @@ function recreateJobs(tz) { if (gJobs.appUpdateChecker) gJobs.appUpdateChecker.stop(); gJobs.appUpdateChecker = new CronJob({ cronTime: '00 ' + randomMinute + ' * * * *', // once an hour - onTick: updateChecker.checkAppUpdates, + onTick: () => updateChecker.checkAppUpdates(NOOP_CALLBACK), start: true, timeZone: tz }); diff --git a/src/updatechecker.js b/src/updatechecker.js index 2ee128c69..b9c19b0c6 100644 --- a/src/updatechecker.js +++ b/src/updatechecker.js @@ -13,6 +13,7 @@ exports = module.exports = { var apps = require('./apps.js'), appstore = require('./appstore.js'), + assert = require('assert'), async = require('async'), constants = require('./constants.js'), debug = require('debug')('box:updatechecker'), @@ -24,8 +25,6 @@ var apps = require('./apps.js'), var gAppUpdateInfo = { }, // id -> update info { creationDate, manifest } gBoxUpdateInfo = null; // { version, changelog, upgrade, sourceTarballUrl } -var NOOP_CALLBACK = function (error) { if (error) debug(error); }; - function loadState() { var state = safe.JSON.parse(safe.fs.readFileSync(paths.UPDATE_CHECKER_FILE, 'utf8')); return state || { }; @@ -62,7 +61,7 @@ function resetAppUpdateInfo(appId) { } function checkAppUpdates(callback) { - callback = callback || NOOP_CALLBACK; // null when called from a timer task + assert.strictEqual(typeof callback, 'function'); debug('Checking App Updates'); @@ -133,7 +132,7 @@ function checkAppUpdates(callback) { } function checkBoxUpdates(callback) { - callback = callback || NOOP_CALLBACK; // null when called from a timer task + assert.strictEqual(typeof callback, 'function'); debug('Checking Box Updates');