Skip to content

Commit

Permalink
Cherry-pick - Fix the ticker interval by removing unnecessary ms (#425)
Browse files Browse the repository at this point in the history
Fix the ticker interval by removing unnecessary ms (#415)
  • Loading branch information
Jeffwan authored Nov 21, 2024
1 parent d885131 commit 3c8bde0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,16 @@ var (
func getPodMetricRefreshInterval() time.Duration {
value, exists := os.LookupEnv("AIBRIX_POD_METRIC_REFRESH_INTERVAL_MS")
if exists {
if intValue, err := strconv.Atoi(value); err == nil {
return time.Duration(intValue) * time.Millisecond
intValue, err := strconv.Atoi(value)
if err != nil {
klog.V(4).Infof("Invalid AIBRIX_POD_METRIC_REFRESH_INTERVAL_MS: %s, falling back to default", value)
} else {
klog.V(4).Infof("Using env value for refresh interval: %d ms", intValue)
return time.Duration(intValue)
}
}
return time.Duration(defaultPodMetricRefreshIntervalInMS) * time.Millisecond
klog.V(4).Infof("Using default refresh interval: %d ms", defaultPodMetricRefreshIntervalInMS)
return time.Duration(defaultPodMetricRefreshIntervalInMS)
}

func GetCache() (*Cache, error) {
Expand Down

0 comments on commit 3c8bde0

Please sign in to comment.