Skip to content

Commit

Permalink
Merge pull request #799 from ynput/enhancement/tray-faster-starting-v…
Browse files Browse the repository at this point in the history
…alidation

Tray: Make starting tray check faster
  • Loading branch information
iLLiCiTiT committed Jul 24, 2024
2 parents 0a647ae + bb39202 commit 9a063b2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion client/ayon_core/tools/tray/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ def _wait_for_starting_tray(
if data.get("started") is True:
return data

pid = data.get("pid")
if pid and not _is_process_running(pid):
remove_tray_server_url()
return None

if time.time() - started_at > timeout:
return None
time.sleep(0.1)
Expand Down Expand Up @@ -276,7 +281,12 @@ def remove_tray_server_url(force: Optional[bool] = False):
except BaseException:
data = {}

if force or not data or data.get("pid") == os.getpid():
if (
force
or not data
or data.get("pid") == os.getpid()
or not _is_process_running(data.get("pid"))
):
os.remove(filepath)


Expand Down

0 comments on commit 9a063b2

Please sign in to comment.