|
@@ -5,17 +5,17 @@ import (
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
-var LabCache MlabCache
|
|
|
+var LabCache *MlabCache
|
|
|
var duration int = 10
|
|
|
|
|
|
type MlabCache struct {
|
|
|
Cache map[string]map[string]float64
|
|
|
Mux sync.Mutex
|
|
|
- Timeout time.Ticker
|
|
|
+ Timeout *time.Ticker
|
|
|
}
|
|
|
|
|
|
func init() {
|
|
|
- LabCache = MlabCache{
|
|
|
+ LabCache = &MlabCache{
|
|
|
Cache: map[string]map[string]float64{
|
|
|
"kube-01": map[string]float64{
|
|
|
"ipc": -1,
|
|
@@ -67,9 +67,13 @@ func init() {
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
- LabCache.Timeout = *time.NewTicker(time.Duration(10) * time.Second)
|
|
|
+ LabCache.Timeout = time.NewTicker(time.Duration(10) * time.Second)
|
|
|
}
|
|
|
|
|
|
+// func New() {
|
|
|
+
|
|
|
+// }
|
|
|
+
|
|
|
// var Τimeout *time.Ticker
|
|
|
|
|
|
func (c *MlabCache) CleanCache() {
|
|
@@ -139,7 +143,7 @@ func (c *MlabCache) UpdateCache(input map[string]float64, c6res float64, nodenam
|
|
|
}
|
|
|
|
|
|
// Reset the ticker
|
|
|
- c.Timeout = *time.NewTicker(time.Duration(duration) * time.Second)
|
|
|
+ c.Timeout = time.NewTicker(time.Duration(duration) * time.Second)
|
|
|
//klog.Infof("Reset the Ticker")
|
|
|
c.Mux.Unlock()
|
|
|
|