Prevent StartMonitoring duplication 39/321939/1
authorChanggyu Choi <changyu.choi@samsung.com>
Tue, 1 Apr 2025 05:42:09 +0000 (14:42 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Tue, 1 Apr 2025 05:42:09 +0000 (14:42 +0900)
If a specific app is not launched and is repeatedly scheduled in the boot sequencer,
there is a problem that the log is repeatedly output due to unnecessary monitoring.
This patch is prevents this case.

Change-Id: I06247152b7d0ffbb58fdcce710715a2a76eee481
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
src/lib/boot_sequencer/app_info.cc
src/lib/boot_sequencer/app_info.hh

index c7980d51fce4660e569a3b34815d89ef5abefe68..0b7e41536ff4b5a0e61f58e26f576d7b933c31e1 100644 (file)
@@ -487,19 +487,29 @@ time_t AppInfo::GetTerminatedTimestamp() const {
 }
 
 void AppInfo::StartMonitoring() {
+  if (monitoring_)
+    return;
+
   for (auto const& vconf : vconf_)
     vconf->Listen();
 
   for (auto const& path_exists : path_exists_)
     path_exists->Start();
+
+  monitoring_ = true;
 }
 
 void AppInfo::StopMonitoring() {
+  if (!monitoring_)
+    return;
+
   for (auto const& path_exists : path_exists_)
     path_exists->Stop();
 
   for (auto const& vconf : vconf_)
     vconf->Ignore();
+
+  monitoring_ = false;
 }
 
 bool AppInfo::CanWait() {
index c55216d075c252f7ddd444f6259bc0714bfb3da7..d35012769957f293c906029bd14a6ccb59835a6d 100644 (file)
@@ -173,6 +173,7 @@ class AppInfo {
   time_t terminated_time_{};
   bool end_timestamp_set_ = false;
   std::string status_msg_;
+  bool monitoring_ = false;
 };
 
 }  // namespace amd::boot_sequencer