fix: address code review findings

This commit is contained in:
2026-08-17 23:40:52 +03:00
parent 9b89b7b9ab
commit 8aecaf1468
8 changed files with 632 additions and 576 deletions

View File

@@ -15,6 +15,9 @@ import (
"trip-planner/internal/metrics"
)
// rng is a seeded random number generator for jitter calculations.
var rng = rand.New(rand.NewSource(time.Now().UnixNano()))
// Client represents a Yandex Schedules API client with rate limiting,
// circuit breaking, and retry capabilities.
type Client struct {
@@ -421,6 +424,5 @@ func applyJitter(backoff time.Duration) time.Duration {
}
func randFloat64() float64 {
// Use math/rand with a seed based on function call index for variability
return rand.Float64()
return rng.Float64()
}