updatechecker: ensure box state information is not lost

the box and app update checker run in parallel. be sure not to lose
the box state information.
This commit is contained in:
Girish Ramakrishnan
2016-08-02 17:38:59 -07:00
parent 9a6e55e4ea
commit b0286a6f7f
2 changed files with 3 additions and 1 deletions

View File

@@ -116,7 +116,7 @@ function checkAppUpdates(callback) {
gAppUpdateInfo = { };
var oldState = loadState();
var newState = { box: oldState.box }; // create new state so that old app ids are removed
var newState = { }; // create new state so that old app ids are removed
apps.getAll(function (error, apps) {
if (error) return callback(error);
@@ -153,6 +153,7 @@ function checkAppUpdates(callback) {
iteratorDone();
});
}, function () {
newState.box = loadState().box; // preserve the latest box state information
saveState(newState);
callback();
});