Commit Graph

4 Commits

Author SHA1 Message Date
Kamil 'Kamaś' Bruchal 4f9cc6c359 feat: harden rota sync and throttle manual /sync
Resolve the current-year sheet tab per fetch instead of freezing it at
startup, so a long-running process follows the New Year rollover without a
restart. Guard against the regression this introduces: a successful fetch
that returns no duty weeks (e.g. a freshly created, empty next-year tab) now
keeps the last-good cache instead of clobbering it with empty data.

Surface a silently-stale cache — which is not a crash, so process-level
supervision can't catch it — by escalating to a loud error log once no sync
has succeeded for 6h (new Store.LastSynced accessor backs the check).

Throttle manual /sync to once per minute across the chat to avoid spamming
the Google Sheets API; the check-and-set is mutex-guarded since Telegram
dispatches each update in its own goroutine.

Update README accordingly.
2026-06-19 02:05:04 +02:00
Kamil 'Kamaś' Bruchal 2e75d15f9d refactor: address review findings (slog, fetch timeout, Docker)
- add per-request timeout to the Sheets fetch so a hung call can't block /sync
- stop leaking raw sync errors to chat; log detail, reply generically
- migrate logging from log to structured log/slog
- drop duplicate godotenv.Load from ReadSheet (LoadConfig loads .env at startup)
- add multi-stage distroless Dockerfile + .dockerignore; embed tzdata via import
- document single-instance long-polling constraint in README
- translate sheet.go comments to English
- move package doc to doc.go; remove superseded root main.go and live_test.go
2026-06-18 21:38:37 +02:00
Kamil 'Kamaś' Bruchal 6c177c9514 fix: lint, interval validation, corrupt-cache tolerance, background init sync, concurrent test 2026-06-17 20:45:29 +02:00
Kamil 'Kamaś' Bruchal 4afe123a76 feat: add in-memory rota Store with atomic JSON persistence 2026-06-17 20:29:04 +02:00