fix(agent-office): dead-letter _dl_notified 갱신을 발송성공 시로 한정 + collect_status 예외방어 (B4 리뷰)
- _dl_notified[name] = dl을 if ok: 블록 안으로 이동 — 텔레그램 실패 시 갱신 방지 - check_and_alert에 collect_status try/except 추가 — 스케줄러 잡 생존 보장 - tests: import app.node_monitor as nm 최상단 이동 - tests: test_dl_notified_not_updated_on_telegram_failure 회귀 테스트 추가 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019LV86jBozkNhSFXJA412fq
This commit is contained in:
@@ -107,7 +107,11 @@ async def check_and_alert(status=None) -> list[str]:
|
||||
"""
|
||||
from .telegram.messaging import send_raw
|
||||
from .db import add_log
|
||||
st = status or await collect_status()
|
||||
try:
|
||||
st = status or await collect_status()
|
||||
except Exception:
|
||||
logger.exception("collect_status 예외")
|
||||
return []
|
||||
sent: list[str] = []
|
||||
for w in st["workers"]:
|
||||
name, alive = w["name"], w.get("alive", False)
|
||||
@@ -129,7 +133,7 @@ async def check_and_alert(status=None) -> list[str]:
|
||||
if (await send_raw(text=text)).get("ok"):
|
||||
add_log("node_monitor", f"{name} dead-letter {dl}", "warning")
|
||||
sent.append(text)
|
||||
_dl_notified[name] = dl
|
||||
_dl_notified[name] = dl
|
||||
elif dl == 0:
|
||||
_dl_notified.pop(name, None)
|
||||
return sent
|
||||
|
||||
Reference in New Issue
Block a user