|
@@ -106,22 +106,23 @@ func customScoreInfluxDB(metrics []string, uuid string, socket,
|
|
|
return calculateWeightedAverage(response, numberOfRows, len(metrics))
|
|
|
}
|
|
|
|
|
|
-// func InvalidateCache() {
|
|
|
-// // Check if the cache needs update
|
|
|
-// select {
|
|
|
-// // clean the cache if 10 seconds are passed
|
|
|
-// case <-customcache.LabCache.Timeout.C:
|
|
|
-// klog.Infof("Time to erase")
|
|
|
-// //customcache.LabCache.Timeout.Stop()
|
|
|
-// customcache.LabCache.CleanCache()
|
|
|
-
|
|
|
-// default:
|
|
|
-// }
|
|
|
-// }
|
|
|
+func InvalidateCache() {
|
|
|
+ // Check if the cache needs update
|
|
|
+ select {
|
|
|
+ // clean the cache if 10 seconds are passed
|
|
|
+ case <-customcache.LabCache.Timeout.C:
|
|
|
+ klog.Infof("Time to erase")
|
|
|
+ klog.Infof("Cache: %v", customcache.LabCache.Cache)
|
|
|
+ //customcache.LabCache.Timeout.Stop()
|
|
|
+ customcache.LabCache.CleanCache()
|
|
|
+
|
|
|
+ default:
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
func customResourceScorer(nodeName string) (float64, error) {
|
|
|
|
|
|
- //InvalidateCache()
|
|
|
+ InvalidateCache()
|
|
|
//klog.Infof("The value of the Ticker: %v", customcache.LabCache.Timeout.C)
|
|
|
cores, _ := Cores[nodeName]
|
|
|
|