From 131afb6684541dbaebde68a540feecf00ab3a99a Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 24 Jul 2024 09:57:59 +0200 Subject: [PATCH] call 'set_tray_server_url' as soon as possible --- client/ayon_core/tools/tray/lib.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/tools/tray/lib.py b/client/ayon_core/tools/tray/lib.py index 66a494b727..a3c69480b4 100644 --- a/client/ayon_core/tools/tray/lib.py +++ b/client/ayon_core/tools/tray/lib.py @@ -164,13 +164,13 @@ def get_tray_server_url( return None -def set_tray_server_url(tray_url: str, started: bool): +def set_tray_server_url(tray_url: Optional[str], started: bool): """Add tray server information file. Called from tray logic, do not use on your own. Args: - tray_url (str): Webserver url with port. + tray_url (Optional[str]): Webserver url with port. started (bool): If tray is started. When set to 'False' it means that tray is starting up. @@ -299,5 +299,12 @@ def main(): os.kill(pid, signal.SIGTERM) remove_tray_server_url() + # Prepare the file with 'pid' information as soon as possible + try: + set_tray_server_url(None, False) + except TrayIsRunningError: + print("Tray is running") + sys.exit(1) + main()