feat: wire main loop with periodic sync+scan and sync_interval config

Replace compute-only run() with an immediate sync+scan followed by a
ticker-driven periodic loop, add the sync.interval config field (default
6h) with defaults and validation, and add tests for the scheduling logic.
This commit is contained in:
2026-07-19 22:27:06 +03:00
parent dc4bdcdab0
commit 0635ca8a87
6 changed files with 313 additions and 30 deletions

View File

@@ -101,10 +101,10 @@ name collisions.)
- [x] run tests - must pass before task 4
### Task 4: Main loop wiring (sync → scan)
- [ ] replace compute-only `run()` with: one immediate sync+scan, then a ticker-driven periodic sync+scan goroutine; keep graceful shutdown via ctx
- [ ] add a `syncInterval` config field (default e.g. 6h) to `config.go` + defaults + validation
- [ ] write tests for the loop scheduling logic where feasible (ticker fires, ctx cancels cleanly)
- [ ] run tests - must pass before task 5
- [x] replace compute-only `run()` with: one immediate sync+scan, then a ticker-driven periodic sync+scan goroutine; keep graceful shutdown via ctx
- [x] add a `syncInterval` config field (default e.g. 6h) to `config.go` + defaults + validation
- [x] write tests for the loop scheduling logic where feasible (ticker fires, ctx cancels cleanly)
- [x] run tests - must pass before task 5
### Task 5: Notifier — Telegram sender + digest
- [ ] define `Sender` interface (`Send(ctx, message string) error`) and a `telegramSender` using `TelegramConfig` (bot API `sendMessage`)