Better pending state check

This commit is contained in:
Girish Ramakrishnan
2019-09-19 16:42:49 -07:00
parent f52c5b584e
commit 579eacb644

View File

@@ -90,8 +90,9 @@ function resumeTasks(callback) {
if (error) return callback(error);
result.forEach(function (app) {
if (app.installationState === apps.ISTATE_INSTALLED && (app.runState === apps.RSTATE_RUNNING || app.runState === apps.RSTATE_STOPPED)) return;
if (app.installationState === apps.ISTATE_ERROR) return;
// if not in any pending state, do nothing
if (app.installationState === apps.ISTATE_INSTALLED || app.installationState === apps.ISTATE_ERROR) return;
if (app.runState === apps.RSTATE_RUNNING || app.runState === apps.RSTATE_STOPPED) return;
debug(`resumeTask: schedule task for ${app.fqdn} ${app.id}: state=${app.installationState},taskId=${app.taskId}`);