Paginate NocoDB reads; alert Telegram on tick failure

send_pending_notifications() read Listings with ?limit=1000 and no paging.
Once the table passed 1000 rows the newest records (highest Id, at the tail)
fell outside page 1, so they were never sent and never marked notified ->
notifications silently dead while health.json stayed ok:true. Found live
2026-09-22: Id 1007-1041 (35 rows, ~29h of listings) never alerted.

- add nc_list_all(): offset-paged full-table read
- use it for listings pending, seen, watches, settings, both ignore lists
- add alert_on_health(): Telegram failure alert debounced over
  ERROR_ALERT_AFTER consecutive failed ticks, plus a recovery notice
  (container already reported unhealthy via healthcheck.py on ok:false)
- new env knob ERROR_ALERT_AFTER wired into compose/.env.example/docs
- test_pagination.py: 30 checks incl. the page-2 regression and alert edges
This commit is contained in:
2026-09-22 03:32:31 +08:00
parent 323fd10838
commit 3c50d084a0
6 changed files with 391 additions and 31 deletions
+2
View File
@@ -13,3 +13,5 @@ TELEGRAM_CHAT_ID=5648309582
TICK_SECONDS=60
FETCH_GAP_SECONDS=1
HEALTH_STALE_SECONDS=600
# 连续失败几次才发 Telegram 故障告警(去抖):
ERROR_ALERT_AFTER=3