优化代码

This commit is contained in:
GoEdgeLab
2022-01-12 20:31:04 +08:00
parent 83d041b8bf
commit 938278725e
23 changed files with 243 additions and 110 deletions

View File

@@ -451,7 +451,7 @@ func (this *Node) syncConfig(taskVersion int64) error {
func (this *Node) startSyncTimer() {
// TODO 这个时间间隔可以自行设置
ticker := time.NewTicker(60 * time.Second)
events.On(events.EventQuit, func() {
events.OnKey(events.EventQuit, this, func() {
remotelogs.Println("NODE", "quit sync timer")
ticker.Stop()
})
@@ -691,7 +691,7 @@ func (this *Node) listenSock() error {
}
})
events.On(events.EventQuit, func() {
events.OnKey(events.EventQuit, this, func() {
logs.Println("NODE", "quit unix sock")
_ = this.sock.Close()
})