feat: notification cooldown dedup for events and problems (notif-31)

Store last notify time by dedup_key/fingerprint, gate dispatch before
channels; config SAC_NOTIFY_*_COOLDOWN_SEC, migration 008.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-29 16:24:01 +10:00
parent 1a70980920
commit 4167687dec
12 changed files with 309 additions and 14 deletions
@@ -0,0 +1,16 @@
from datetime import datetime
from sqlalchemy import DateTime, String
from sqlalchemy.orm import Mapped, mapped_column
from app.database import Base
class NotificationCooldown(Base):
"""Последняя отправка оповещения по ключу (dedup_key / fingerprint)."""
__tablename__ = "notification_cooldown"
cooldown_key: Mapped[str] = mapped_column(String(512), primary_key=True)
kind: Mapped[str] = mapped_column(String(16)) # event | problem
last_notified_at: Mapped[datetime] = mapped_column(DateTime(timezone=True))