|
@@ -0,0 +1,29 @@
|
|
|
+package service
|
|
|
+
|
|
|
+import (
|
|
|
+ "cicv-data-closedloop/common/util"
|
|
|
+ "sync"
|
|
|
+)
|
|
|
+
|
|
|
+var (
|
|
|
+ MonitorQueue = make([]MonitorInfo, 0, QueueLength)
|
|
|
+ QueueLength = 120
|
|
|
+ mu sync.Mutex
|
|
|
+)
|
|
|
+
|
|
|
+type MonitorInfo struct {
|
|
|
+ Time string
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func CacheMonitorQueue() {
|
|
|
+ mu.Lock()
|
|
|
+ defer mu.Unlock()
|
|
|
+
|
|
|
+
|
|
|
+ if len(MonitorQueue) >= QueueLength {
|
|
|
+ MonitorQueue = MonitorQueue[1:]
|
|
|
+ }
|
|
|
+
|
|
|
+ MonitorQueue = append(MonitorQueue, MonitorInfo{Time: util.GetNowTimeCustom()})
|
|
|
+}
|