refactor: move startup probe to daemon thread with 10s timeout
All checks were successful
CVE Scan & Docker Build / security-scan (push) Successful in 1m1s
CVE Scan & Docker Build / build-and-push (push) Successful in 3m15s

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.
This commit is contained in:
2026-05-15 10:05:09 -04:00
parent ba3ab3d855
commit a3d017a70d

View File

@@ -201,6 +201,13 @@ class LibraryConfig(AppConfig):
def ready(self): def ready(self):
if _should_skip_probe(): if _should_skip_probe():
return return
import threading
t = threading.Thread(target=self._probe_thread, daemon=True)
t.start()
t.join(timeout=10)
def _probe_thread(self):
try: try:
_run_startup_probe() _run_startup_probe()
except Exception as exc: except Exception as exc: