推送旧信号闸门:divergence_time距今>30分钟的pending通知置skipped不弹推送(补扫/宕机追赶批量产出的历史信号只留App列表可见)
This commit is contained in:
@@ -135,9 +135,20 @@ def send_signal_sms() -> None:
|
||||
|
||||
|
||||
def push_pending() -> None:
|
||||
"""把 pending 通知推出去。失败保持 pending;>30 分钟置 expired。"""
|
||||
"""把 pending 通知推出去。失败保持 pending;>30 分钟置 expired。
|
||||
|
||||
旧信号闸门(2026-11-24):判定失败修复/宕机重启/数据回流补判会批量产出
|
||||
历史日期的信号,divergence_time 距今 >30 分钟的不弹推送(置 skipped),
|
||||
只保留 App 内通知列表可见——避免补扫把半年前的点半夜推成闹钟。"""
|
||||
from ..notify.push import push_batch # 延迟导入,避免无凭证时报错
|
||||
|
||||
gate = (_now() - timedelta(minutes=30)).strftime("%Y-%m-%d %H:%M:%S")
|
||||
execute(
|
||||
"UPDATE notifications SET push_status='skipped' "
|
||||
"WHERE push_status='pending' AND signal_id IN "
|
||||
"(SELECT id FROM signals WHERE divergence_time < ?)",
|
||||
(gate,),
|
||||
)
|
||||
expire_before = (_now() - timedelta(minutes=30)).strftime("%Y-%m-%d %H:%M:%S")
|
||||
execute(
|
||||
"UPDATE notifications SET push_status='expired' "
|
||||
|
||||
Reference in New Issue
Block a user