mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-05 08:30:27 +08:00
修复节点自动升级时无法自动启动的Bug
This commit is contained in:
@@ -30,10 +30,14 @@ type NodeStatusExecutor struct {
|
||||
cpuUpdatedTime time.Time
|
||||
cpuLogicalCount int
|
||||
cpuPhysicalCount int
|
||||
|
||||
ticker *time.Ticker
|
||||
}
|
||||
|
||||
func NewNodeStatusExecutor() *NodeStatusExecutor {
|
||||
return &NodeStatusExecutor{}
|
||||
return &NodeStatusExecutor{
|
||||
ticker: time.NewTicker(30 * time.Second),
|
||||
}
|
||||
}
|
||||
|
||||
func (this *NodeStatusExecutor) Listen() {
|
||||
@@ -41,15 +45,12 @@ func (this *NodeStatusExecutor) Listen() {
|
||||
this.cpuUpdatedTime = time.Now()
|
||||
this.update()
|
||||
|
||||
// TODO 这个时间间隔可以配置
|
||||
var ticker = time.NewTicker(30 * time.Second)
|
||||
|
||||
events.OnKey(events.EventQuit, this, func() {
|
||||
remotelogs.Println("NODE_STATUS", "quit executor")
|
||||
ticker.Stop()
|
||||
this.ticker.Stop()
|
||||
})
|
||||
|
||||
for range ticker.C {
|
||||
for range this.ticker.C {
|
||||
this.isFirstTime = false
|
||||
this.update()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user