From 25ac4f6838aeaba2045edd51fa817c6b773af9c8 Mon Sep 17 00:00:00 2001 From: Mike Sul Date: Mon, 2 Dec 2024 16:22:16 +0100 Subject: [PATCH] apps: Check if app running before if fetched 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 --- src/composeappmanager.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/composeappmanager.cc b/src/composeappmanager.cc index 394c428d..61d3447a 100644 --- a/src/composeappmanager.cc +++ b/src/composeappmanager.cc @@ -230,13 +230,6 @@ 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); @@ -244,6 +237,13 @@ ComposeAppManager::AppsContainer ComposeAppManager::getAppsToUpdate(const Uptane 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;