Packages: check for existing update when scheduling

This is fixing an issue identified in the launcher in a secondary way,
to ensure if another user of the API tries to schedule an already
scheduled package, we ignore the second request.
This commit is contained in:
James Turner
2018-10-05 10:40:35 +01:00
parent 6ffc501566
commit efc609577f

View File

@@ -594,6 +594,12 @@ void Root::scheduleToUpdate(InstallRef aInstall)
if (!aInstall) {
throw sg_exception("missing argument to scheduleToUpdate");
}
auto it = std::find(d->updateDeque.begin(), d->updateDeque.end(), aInstall);
if (it != d->updateDeque.end()) {
// already scheduled to update
return;
}
PackageList deps = aInstall->package()->dependencies();
for (Package* dep : deps) {