merge appdb.js into apps.js
This commit is contained in:
@@ -14,6 +14,7 @@ const apps = require('./apps.js'),
|
||||
CronJob = require('cron').CronJob,
|
||||
debug = require('debug')('box:scheduler'),
|
||||
docker = require('./docker.js'),
|
||||
util = require('util'),
|
||||
_ = require('underscore');
|
||||
|
||||
// appId -> { containerId, schedulerConfig (manifest), cronjobs }
|
||||
@@ -41,8 +42,9 @@ function runTask(appId, taskName, callback) {
|
||||
|
||||
if (gSuspendedAppIds.has(appId)) return callback();
|
||||
|
||||
apps.get(appId, function (error, app) {
|
||||
util.callbackify(apps.get)(appId, function (error, app) {
|
||||
if (error) return callback(error);
|
||||
if (!app) return callback(new BoxError(BoxError.NOT_FOUND, 'App not found'));
|
||||
|
||||
if (app.installationState !== apps.ISTATE_INSTALLED || app.runState !== apps.RSTATE_RUNNING || app.health !== apps.HEALTH_HEALTHY) return callback();
|
||||
|
||||
@@ -121,7 +123,7 @@ function stopJobs(appId, appState, callback) {
|
||||
function sync() {
|
||||
if (constants.TEST) return;
|
||||
|
||||
apps.getAll(function (error, allApps) {
|
||||
util.callbackify(apps.list)(function (error, allApps) {
|
||||
if (error) return debug(`sync: error getting app list. ${error.message}`);
|
||||
|
||||
var allAppIds = allApps.map(function (app) { return app.id; });
|
||||
|
||||
Reference in New Issue
Block a user