Use business logic for getting all apps in taskmanager

This commit is contained in:
Johannes Zellner
2018-06-29 16:56:36 +02:00
parent f53c526677
commit f4f6f4e7e0

View File

@@ -13,6 +13,7 @@ exports = module.exports = {
};
var appdb = require('./appdb.js'),
apps = require('./apps.js'),
assert = require('assert'),
async = require('async'),
child_process = require('child_process'),
@@ -43,12 +44,11 @@ function resumeTasks(callback) {
gPaused = false;
appdb.getAll(function (error, apps) {
apps.getAll(function (error, result) {
if (error) return callback(error);
apps.forEach(function (app) {
result.forEach(function (app) {
if (app.installationState === appdb.ISTATE_INSTALLED && app.runState === appdb.RSTATE_RUNNING) return;
if (app.installationState === appdb.ISTATE_ERROR) return;
debug('Creating process for %s (%s) with state %s', app.fqdn, app.id, app.installationState);