From 13607c104d1ffa4779dd874a599aa81b42ad95cb Mon Sep 17 00:00:00 2001 From: yuzuki999 Date: Fri, 19 May 2023 11:34:34 +0800 Subject: [PATCH] fix report interval --- node/task.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/node/task.go b/node/task.go index bc3be75..df92255 100644 --- a/node/task.go +++ b/node/task.go @@ -15,24 +15,24 @@ import ( func (c *Controller) initTask() { // fetch node info task c.nodeInfoMonitorPeriodic = &task.Periodic{ - Interval: time.Duration(c.nodeInfo.BaseConfig.PullInterval.(int)) * time.Second, + Interval: c.nodeInfo.BaseConfig.PullInterval.(time.Duration), Execute: c.nodeInfoMonitor, } // fetch user list task c.userReportPeriodic = &task.Periodic{ - Interval: time.Duration(c.nodeInfo.BaseConfig.PushInterval.(int)) * time.Second, + Interval: c.nodeInfo.BaseConfig.PushInterval.(time.Duration), Execute: c.reportUserTraffic, } log.Printf("[%s: %d] Start monitor node status", c.nodeInfo.NodeType, c.nodeInfo.NodeId) // delay to start nodeInfoMonitor go func() { - time.Sleep(time.Duration(c.nodeInfo.BaseConfig.PullInterval.(int)) * time.Second) + time.Sleep(c.nodeInfo.BaseConfig.PullInterval.(time.Duration)) _ = c.nodeInfoMonitorPeriodic.Start() }() log.Printf("[%s: %d] Start report node status", c.nodeInfo.NodeType, c.nodeInfo.NodeId) // delay to start userReport go func() { - time.Sleep(time.Duration(c.nodeInfo.BaseConfig.PushInterval.(int)) * time.Second) + time.Sleep(c.nodeInfo.BaseConfig.PushInterval.(time.Duration)) _ = c.userReportPeriodic.Start() }() if c.nodeInfo.Tls != 0 && c.CertConfig.CertMode != "none" &&