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:
@@ -594,6 +594,12 @@ void Root::scheduleToUpdate(InstallRef aInstall)
|
|||||||
if (!aInstall) {
|
if (!aInstall) {
|
||||||
throw sg_exception("missing argument to scheduleToUpdate");
|
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();
|
PackageList deps = aInstall->package()->dependencies();
|
||||||
for (Package* dep : deps) {
|
for (Package* dep : deps) {
|
||||||
|
|||||||
Reference in New Issue
Block a user