From 697e4e36c95d1cb37eb1c486cd6180d51c9a4532 Mon Sep 17 00:00:00 2001 From: Folzo Date: Sun, 2 Aug 2026 01:13:21 +0200 Subject: [PATCH] jean-router: WoL ne se declenche plus si Ollama repond (PC allume) - jean_alive verifie Jean(8090) OU Ollama(11434) - WoL seulement si les DEUX sont inaccessibles - Logs WoL espaces a 5s au lieu de 2s --- jean-router/app.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/jean-router/app.py b/jean-router/app.py index c0fd706..407236e 100644 --- a/jean-router/app.py +++ b/jean-router/app.py @@ -133,17 +133,24 @@ def send_wol(): def jean_alive() -> bool: - """Verifie si Jean est accessible""" + """Verifie si le PC gaming est accessible (Jean ou Ollama)""" now = time.time() if now - jean_alive_cache["timestamp"] < 2: return jean_alive_cache["alive"] + alive = False try: - url = f"http://{JEAN_WEB_HOST}:{JEAN_WEB_PORT}/api/presets" - r = requests.get(url, timeout=3) + r = requests.get(f"http://{JEAN_WEB_HOST}:{JEAN_WEB_PORT}/api/presets", timeout=3) alive = r.ok except Exception: - alive = False + pass + + if not alive: + try: + r = requests.get(f"http://{OLLAMA_DIRECT_HOST}:{OLLAMA_DIRECT_PORT}/api/version", timeout=2) + alive = r.ok + except Exception: + pass jean_alive_cache["alive"] = alive jean_alive_cache["timestamp"] = now @@ -174,7 +181,7 @@ def wait_for_jean(trigger_wol=True): log.info(f"[WoL] Jean UP apres {int(time.time() - deadline + WAKE_TIMEOUT)}s") return log.info(f"[WoL] En attente... ({remaining}s restantes)") - time.sleep(CHECK_INTERVAL) + time.sleep(max(CHECK_INTERVAL, 5)) log.error(f"[WoL] Jean ne repond pas apres {WAKE_TIMEOUT}s")