Files
carousell-monitor/.env.example
T
hoelee 3c50d084a0 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
2026-09-22 03:32:31 +08:00

18 lines
450 B
Bash

# Copy to .env and fill in. All values are required.
# NocoDB (container DNS when on bridge_hoelee; LAN IP from a desktop):
NOCODB_URL=http://nocodb:10380
NOCODB_BASE_ID=poqw1zjw3hnsk37
NOCODB_TOKEN=
# Telegram alerts (@HoeleeAgentBot):
TELEGRAM_BOT_TOKEN=
TELEGRAM_CHAT_ID=5648309582
# Optional tuning:
TICK_SECONDS=60
FETCH_GAP_SECONDS=1
HEALTH_STALE_SECONDS=600
# 连续失败几次才发 Telegram 故障告警(去抖):
ERROR_ALERT_AFTER=3