Fixup repair route

* Do not allow scheduling tasks in error state
* Only repair is allowed in error state
* Use the error object to track what to 'repair' (like the lastState)
* If uninstall failed, repair will do uninstall
* If move dir failed, repair will do move dir
This commit is contained in:
Girish Ramakrishnan
2019-09-21 19:45:55 -07:00
parent 37f28746fc
commit ff1f448860
5 changed files with 156 additions and 45 deletions

View File

@@ -458,7 +458,11 @@ function setTask(appId, values, callback) {
assert.strictEqual(typeof values, 'object');
assert.strictEqual(typeof callback, 'function');
updateWithConstraints(appId, values, 'AND taskId IS NULL', callback);
if (values.installationState === 'pending_repair') { // FIXME
updateWithConstraints(appId, values, 'AND taskId IS NULL AND installationState == "error"', callback);
} else {
updateWithConstraints(appId, values, 'AND taskId IS NULL AND installationState != "error"', callback);
}
}
function getAppStoreIds(callback) {