Make restore/configure use scheduleTask
This commit is contained in:
+3
-3
@@ -1419,14 +1419,14 @@ function restoreInstalledApps(callback) {
|
|||||||
|
|
||||||
async.map(apps, function (app, iteratorDone) {
|
async.map(apps, function (app, iteratorDone) {
|
||||||
backups.getByAppIdPaged(1, 1, app.id, function (error, results) {
|
backups.getByAppIdPaged(1, 1, app.id, function (error, results) {
|
||||||
const restoreConfig = !error && results.length ? { backupId: results[0].id, backupFormat: results[0].format } : null;
|
const restoreConfig = !error && results.length ? { backupId: results[0].id, backupFormat: results[0].format, oldManifest: app.manifest } : null;
|
||||||
|
|
||||||
debug(`marking ${app.fqdn} for restore using restore config ${JSON.stringify(restoreConfig)}`);
|
debug(`marking ${app.fqdn} for restore using restore config ${JSON.stringify(restoreConfig)}`);
|
||||||
|
|
||||||
appdb.setInstallationCommand(app.id, appdb.ISTATE_PENDING_RESTORE, { restoreConfig: restoreConfig }, function (error) {
|
appdb.setInstallationCommand(app.id, appdb.ISTATE_PENDING_RESTORE, { restoreConfig: restoreConfig }, function (error) {
|
||||||
if (error) debug(`Error marking ${app.fqdn} for restore: ${JSON.stringify(error)}`);
|
if (error) debug(`Error marking ${app.fqdn} for restore: ${JSON.stringify(error)}`);
|
||||||
|
|
||||||
iteratorDone(); // always succeed
|
scheduleTask(app.id, { restoreConfig }, () => iteratorDone()); // always succeed
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, callback);
|
}, callback);
|
||||||
@@ -1445,7 +1445,7 @@ function configureInstalledApps(callback) {
|
|||||||
appdb.setInstallationCommand(app.id, appdb.ISTATE_PENDING_CONFIGURE, { }, function (error) {
|
appdb.setInstallationCommand(app.id, appdb.ISTATE_PENDING_CONFIGURE, { }, function (error) {
|
||||||
if (error) debug(`Error marking ${app.fqdn} for reconfigure: ${JSON.stringify(error)}`);
|
if (error) debug(`Error marking ${app.fqdn} for reconfigure: ${JSON.stringify(error)}`);
|
||||||
|
|
||||||
iteratorDone(); // always succeed
|
scheduleTask(app.id, { oldConfig: getAppConfig(app) }, () => iteratorDone()); // always succeed
|
||||||
});
|
});
|
||||||
}, callback);
|
}, callback);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user