From ca2be388c8628ca5e990ed37ecb9521af39d6223 Mon Sep 17 00:00:00 2001 From: qmhu Date: Fri, 11 Aug 2023 16:10:53 +0800 Subject: [PATCH] fix lint --- pkg/controller/recommendation/recommendation_checker.go | 5 ++++- .../recommendation/recommendation_rule_controller.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/controller/recommendation/recommendation_checker.go b/pkg/controller/recommendation/recommendation_checker.go index 804424659..c3ebfa064 100644 --- a/pkg/controller/recommendation/recommendation_checker.go +++ b/pkg/controller/recommendation/recommendation_checker.go @@ -20,11 +20,14 @@ type Checker struct { func (r Checker) Run(stopCh <-chan struct{}) { go func() { + ticker := time.NewTicker(r.MonitorInterval) + defer ticker.Stop() + for { select { case <-stopCh: return - case <-time.Tick(r.MonitorInterval): + case <-ticker.C: r.runChecker() } } diff --git a/pkg/controller/recommendation/recommendation_rule_controller.go b/pkg/controller/recommendation/recommendation_rule_controller.go index cdbcfe922..f3e9a76e7 100644 --- a/pkg/controller/recommendation/recommendation_rule_controller.go +++ b/pkg/controller/recommendation/recommendation_rule_controller.go @@ -3,7 +3,6 @@ package recommendation import ( "context" "fmt" - "github.com/gocrane/crane/pkg/metrics" "sort" "strconv" "strings" @@ -33,6 +32,7 @@ import ( analysisv1alph1 "github.com/gocrane/api/analysis/v1alpha1" "github.com/gocrane/crane/pkg/known" + "github.com/gocrane/crane/pkg/metrics" "github.com/gocrane/crane/pkg/oom" predictormgr "github.com/gocrane/crane/pkg/predictor" "github.com/gocrane/crane/pkg/providers"