clear taskId in the parent process

This commit is contained in:
Girish Ramakrishnan
2019-08-29 13:43:45 -07:00
parent 0da6539c48
commit bb62e6a318
2 changed files with 12 additions and 9 deletions

View File

@@ -596,9 +596,12 @@ function scheduleTask(appId, args, values, callback) {
if (error) return callback(new AppsError(AppsError.INTERNAL_ERROR, error));
appTaskManager.scheduleTask(appId, taskId, function (error) {
debug(`scheduleTask: task ${taskId} of $${appId} completed`);
if (error && (error.crashed || error.stopped)) {
debug(`Apptask crashed/stopped: ${error.message}`);
appdb.update(appId, { installationState: appdb.ISTATE_ERROR, errorMessage: error.message, taskId: null }, NOOP_CALLBACK);
} else {
appdb.update(appId, { taskId: null }, NOOP_CALLBACK);
}
});