From 7d79be43fbac39bf108ce7530cfa1279ef8a41e6 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Fri, 27 Dec 2024 16:32:13 -0800 Subject: [PATCH] Refactor restart to allow time for the GUI display to start --- neon_phal_plugin_system/__init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/neon_phal_plugin_system/__init__.py b/neon_phal_plugin_system/__init__.py index d07bad7..3bd5620 100644 --- a/neon_phal_plugin_system/__init__.py +++ b/neon_phal_plugin_system/__init__.py @@ -294,15 +294,14 @@ def handle_mycroft_restarting(self, message: Message): def handle_mycroft_restart_request(self, message: Message): service = self.core_service_name self.bus.emit(message.forward("system.mycroft.service.restart.start", message.data)) - + # Allow some time for the GUI display to start + sleep(5) try: restart_service(service, sudo=False, user=self.core_service_is_user) except Exception as e: LOG.error(f"Failed to restart service: {e}") - # Allow some time for the GUI display to start and release it - sleep(5) - self.gui.clear() + self.gui.clear() # Release the GUI def handle_ssh_status(self, message: Message): """