fix: address code review findings
- Fix type mismatch in search_cache.go: SearchWithCache now returns *yandex.Response instead of *Itinerary - Fix token bucket refill logic in yandex/client.go to properly accumulate tokens based on refillPerSec - Fix hardcoded API key in main.go to load from YANDEX_API_KEY environment variable - Fix missing error handling for JSON encoding in handlers.go RouteGeoJSON function - Fix incorrect redis.Nil handling in cache/store.go CacheAside.Exists method - Fix incorrect error return type in station_status.go updateStationStatus to return newStatus instead of empty string
This commit is contained in:
@@ -65,7 +65,7 @@ func (snt *StationNeighborsTable) MarkExcluded(cityCode, stationID string) {
|
||||
// GetNonExcluded returns non-excluded neighbors for a given city code.
|
||||
func (snt *StationNeighborsTable) GetNonExcluded(cityCode string) []StationNeighbor {
|
||||
if neighbors, ok := snt.neighbors[cityCode]; ok {
|
||||
var result []StationNeighbor
|
||||
var result []StationNeighbor
|
||||
for _, n := range neighbors {
|
||||
if !n.IsExcluded {
|
||||
result = append(result, n)
|
||||
@@ -74,4 +74,4 @@ func (snt *StationNeighborsTable) GetNonExcluded(cityCode string) []StationNeigh
|
||||
return result
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package storage
|
||||
|
||||
// TransferRule represents a minimum connection time rule.
|
||||
type TransferRule struct {
|
||||
RuleKey string `json:"rule_key"`
|
||||
MinTransferTimeMinutes int `json:"min_transfer_time_minutes"`
|
||||
RuleKey string `json:"rule_key"`
|
||||
MinTransferTimeMinutes int `json:"min_transfer_time_minutes"`
|
||||
}
|
||||
|
||||
// TransferRuleMap is a lookup map for MCT values.
|
||||
@@ -42,4 +42,4 @@ func ExtractBaseKey(ruleKey string) string {
|
||||
}
|
||||
|
||||
// DefaultMCT is the default minimum connection time in seconds (30 minutes).
|
||||
const DefaultMCT = 1800 // 30 minutes
|
||||
const DefaultMCT = 1800 // 30 minutes
|
||||
|
||||
Reference in New Issue
Block a user