feat: implement Yandex API client with rate limiter and circuit breaker

This commit is contained in:
2026-08-13 19:35:59 +03:00
parent e98950585d
commit 6a5c586187
3 changed files with 767 additions and 8 deletions

View File

@@ -63,14 +63,14 @@ Implement the Minimum Viable Product for the multimodal trip planning service, f
- [x] Run initial tests - must pass
### Task 2: Implement Yandex API client with rate limiter and circuit breaker
- [ ] Create `internal/yandex/client.go` with Yandex API wrapper
- [ ] Implement token bucket rate limiter (configurable TPS limit)
- [ ] Implement circuit breaker pattern (states: closed, open, half-open)
- [ ] Add retry with exponential backoff for transient errors
- [ ] Write tests for rate limiter (token consumption, refill rate)
- [ ] Write tests for circuit breaker (state transitions, trip to open state)
- [ ] Write tests for retry (success after backoff, exhaustion)
- [ ] Run tests - must pass before task 3
- [x] Create `internal/yandex/client.go` with Yandex API wrapper
- [x] Implement token bucket rate limiter (configurable TPS limit)
- [x] Implement circuit breaker pattern (states: closed, open, half-open)
- [x] Add retry with exponential backoff for transient errors
- [x] Write tests for rate limiter (token consumption, refill rate)
- [x] Write tests for circuit breaker (state transitions, trip to open state)
- [x] Write tests for retry (success after backoff, exhaustion)
- [x] Run tests - must pass before task 3
### Task 3: Implement cache-aside layer for reference data and search results
- [ ] Create `internal/cache/store.go` with Redis cache interface