From a3d017a70dad5ff08b6c928fe838b0a9179bc20c Mon Sep 17 00:00:00 2001 From: Robert Helewka Date: Fri, 15 May 2026 10:05:09 -0400 Subject: [PATCH] refactor: move startup probe to daemon thread with 10s timeout Move the _run_startup_probe logic into a separate daemon thread within LibraryConfig.ready. This prevents indefinite blocking on startup while maintaining a 10-second wait for the probe result. --- mnemosyne/library/apps.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mnemosyne/library/apps.py b/mnemosyne/library/apps.py index 162d10f..3995e95 100644 --- a/mnemosyne/library/apps.py +++ b/mnemosyne/library/apps.py @@ -201,6 +201,13 @@ class LibraryConfig(AppConfig): def ready(self): if _should_skip_probe(): return + import threading + + t = threading.Thread(target=self._probe_thread, daemon=True) + t.start() + t.join(timeout=10) + + def _probe_thread(self): try: _run_startup_probe() except Exception as exc: