From e54a748a38a887b67afe57676021cdb155817bc8 Mon Sep 17 00:00:00 2001 From: Fred Clausen <43556888+fredclausen@users.noreply.github.com> Date: Tue, 15 Aug 2023 17:24:21 -0600 Subject: [PATCH] bug fix container start emit message --- rootfs/monitor-hub/monitor-hub.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rootfs/monitor-hub/monitor-hub.py b/rootfs/monitor-hub/monitor-hub.py index cf4ff61..f957720 100644 --- a/rootfs/monitor-hub/monitor-hub.py +++ b/rootfs/monitor-hub/monitor-hub.py @@ -113,6 +113,10 @@ def clear_logs(self): db.close() except Exception as e: print(f"Error clearing logs: {e}") + finally: + containers.remove(self.name) + # remove container from the list of container classes + container_classes.remove(self) def get_log(self, num_lines=50): results = [] @@ -209,10 +213,7 @@ def container_logs(self, container): {"name": container.name}, namespace="/main", ) - - containers.remove(container.name) - # remove container from the list of container classes - container_classes.remove(self) + self.clear_logs() def exit_handler(signal_received, _): @@ -248,7 +249,7 @@ def check_for_new_containers(): print(f"New container: {c.get_name()}") if container_ready: socketio.emit( - "new_container", + "container_start", { "name": c.get_name(), },