Skip to content

Commit

Permalink
apps: Check if app running before if fetched
Browse files Browse the repository at this point in the history
Checking whether app is running is faster compared to checking  whether
app is fully fetched. So, let us do the lighter check before the heavy
one; if app is not running aklite attempts to re-fetch and re-install it
anyway.

Signed-off-by: Mike Sul <[email protected]>
  • Loading branch information
mike-sul committed Dec 2, 2024
1 parent 688f103 commit 25ac4f6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/composeappmanager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,20 +230,20 @@ ComposeAppManager::AppsContainer ComposeAppManager::getAppsToUpdate(const Uptane
}

LOG_DEBUG << app_name << " performing full status check";
if (!app_engine_->isFetched({app_name, app_pair.second})) {
// an App that is supposed to be installed is not fully installed
apps_to_update.insert(app_pair);
apps_and_reasons[app_pair.first] = "not fetched";
LOG_INFO << app_name << " is not fully fetched; missing blobs will be fetched";
continue;
}
if (!app_engine_->isRunning({app_name, app_pair.second})) {
// an App that is supposed to running is not running
apps_to_update.insert(app_pair);
apps_and_reasons[app_pair.first] = "not running";
LOG_INFO << app_name << " is not installed or not running; will be installed and started";
continue;
}
if (!app_engine_->isFetched({app_name, app_pair.second})) {
// an App that is supposed to be installed is not fully installed
apps_to_update.insert(app_pair);
apps_and_reasons[app_pair.first] = "not fetched";
LOG_INFO << app_name << " is not fully fetched; missing blobs will be fetched";
continue;
}
}

return apps_to_update;
Expand Down

0 comments on commit 25ac4f6

Please sign in to comment.