revert: 移除 Telegram Redis dedup 邏輯

原因: dedup 邏輯導致 Telegram 完全無法發送
保留: INC- 前綴修復 (approval_id = incident.incident_id)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-03-26 21:53:39 +08:00
parent d3a0ed4253
commit bb6151cf44

View File

@@ -59,18 +59,6 @@ async def _push_decision_to_telegram(
get_telegram_gateway,
)
# 2026-03-26 修復: 防止重複發送 Telegram (每 incident 10 分鐘只發一次)
redis_client = get_redis()
dedup_key = f"telegram_sent:{incident.incident_id}"
already_sent = await redis_client.get(dedup_key)
if already_sent:
logger.debug(
"telegram_push_skipped_dedup",
incident_id=incident.incident_id,
reason="Already sent within 10 minutes",
)
return
# 檢查是否有設定 Bot Token
if not settings.OPENCLAW_TG_BOT_TOKEN:
logger.debug(
@@ -106,9 +94,6 @@ async def _push_decision_to_telegram(
namespace=incident.signals[0].labels.get("namespace", "default") if incident.signals else "default",
)
# 2026-03-26 修復: 標記已發送10 分鐘內不再發送
await redis_client.set(dedup_key, "1", ex=600)
logger.info(
"telegram_decision_pushed",
incident_id=incident.incident_id,