fix(F-704): run_curation in asyncio.to_thread — verhindert Event-Loop-Blockierung und Watchdog Exit 75 — @implements: [F-704]
This commit is contained in:
+21
-3
@@ -7836,8 +7836,15 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
sub_rest = parts[1] if len(parts) > 1 else ""
|
||||
|
||||
# ── :: keywords curate (ohne Subcommand) → Lauf triggern ──────
|
||||
# F-704: run_curation() läuft sync (urllib-Call in _default_llm_check).
|
||||
# In einem async Handler würde der sync Call den Event Loop blockieren
|
||||
# → Watchdog kann aussteigen (Exit 75). Run in einen Thread delegieren.
|
||||
if not sub_action:
|
||||
run_id = curator.run_curation(trigger_mode="manual", trigger_reason="inline command")
|
||||
run_id = await asyncio.to_thread(
|
||||
curator.run_curation,
|
||||
trigger_mode="manual",
|
||||
trigger_reason="inline command",
|
||||
)
|
||||
if run_id is None:
|
||||
return "⏸️ Kurator übersprungen (Cooldown aktiv oder keine pending Keywords)."
|
||||
return f"🤖 Butler-Kurator-Lauf gestartet. `run_id`: `{run_id}`"
|
||||
@@ -11529,11 +11536,22 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
logger.warning("[rocketchat] Kurator: Mengen-Trigger fehlgeschlagen: %s", e)
|
||||
|
||||
async def _run_curator_async(self, curator) -> None:
|
||||
"""Führt einen Kurator-Lauf asynchron aus (fire-and-forget)."""
|
||||
"""Führt einen Kurator-Lauf asynchron aus (fire-and-forget).
|
||||
|
||||
F-704: run_curation() ist sync (urllib-Call in _default_llm_check) und
|
||||
würde sonst mit sync await den Event Loop blockieren. In einen Thread
|
||||
auslagern, damit kein Watchdog-Aussteigen (Exit 75).
|
||||
"""
|
||||
try:
|
||||
run_id = curator.run_curation(trigger_mode="count", trigger_reason="mengen-trigger")
|
||||
run_id = await asyncio.to_thread(
|
||||
curator.run_curation,
|
||||
trigger_mode="count",
|
||||
trigger_reason="mengen-trigger",
|
||||
)
|
||||
if run_id:
|
||||
logger.info("[rocketchat] Kurator: Mengen-Lauf %s abgeschlossen", run_id)
|
||||
except asyncio.CancelledError:
|
||||
raise
|
||||
except Exception as e:
|
||||
logger.warning("[rocketchat] Kurator: Mengen-Lauf fehlgeschlagen: %s", e)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user