feat: implement cron job for station status detection

- Create cmd/cron/station_status.go with daily station status checking
- Implement schedule querying via Yandex API with rate limiting and circuit breaker
- Closure detection: N consecutive days of zero trips (N=3) → closed status
- Reactivation: active status when trips resume after being closed
- Add tests for cron logic: status transition, zero-flight detection, reactivation
- All tests pass: go test ./cmd/cron/ and go test ./...
This commit is contained in:
2026-08-13 20:42:34 +03:00
parent 1bfe659d2c
commit 6f69da0761
3 changed files with 410 additions and 6 deletions

View File

@@ -104,12 +104,12 @@ Implement the Minimum Viable Product for the multimodal trip planning service, f
- [x] Run tests - must pass before task 6
### Task 6: Implement cron job for station status detection
- [ ] Create `cmd/cron/station_status.go` daily cron job
- [ ] Query `/schedule` for each monitored station, count flights on upcoming dates
- [ ] Implement closure detection: N consecutive days of zero trips (N=3 recommended) → status `closed`
- [ ] Implement reactivation: status `active` when >0 trips appear
- [ ] Write tests for cron logic (status transition, zero-flight detection, reactivation)
- [ ] Run tests - must pass before task 7
- [x] Create `cmd/cron/station_status.go` daily cron job
- [x] Query `/schedule` for each monitored station, count flights on upcoming dates
- [x] Implement closure detection: N consecutive days of zero trips (N=3 recommended) → status `closed`
- [x] Implement reactivation: status `active` when >0 trips appear
- [x] Write tests for cron logic (status transition, zero-flight detection, reactivation)
- [x] Run tests - must pass before task 7
### Task 7: End-to-end integration and full test suite
- [ ] Write integration tests connecting all components: API → cache → routing → Yandex client