From 564204c777a513e8d962628b641d5eb710c3b27e Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 25 Aug 2022 11:32:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E5=99=A8=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=20=E4=B8=8D=E4=BD=BF=E7=94=A8=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E9=87=8A=E6=94=BE=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/v2/service/connService.go | 1 + sys/configure/configure.go | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/v2/service/connService.go b/cmd/v2/service/connService.go index 14085f485..6128a85ee 100644 --- a/cmd/v2/service/connService.go +++ b/cmd/v2/service/connService.go @@ -55,6 +55,7 @@ func (c *ConnServiceImpl) WsConnect(wsUrl string) error { c.ws = ws ticker := time.NewTicker(2 * time.Second) + defer ticker.Stop() go func() { for { _ = <-ticker.C diff --git a/sys/configure/configure.go b/sys/configure/configure.go index 356b89040..c9c833370 100644 --- a/sys/configure/configure.go +++ b/sys/configure/configure.go @@ -46,14 +46,15 @@ type Configure struct { } func (this *Configure) Start() (err error) { - tc := time.NewTicker(time.Second * time.Duration(this.options.CheckInterval)) + timer := time.NewTicker(time.Second * time.Duration(this.options.CheckInterval)) + defer timer.Stop() go func() { locp: for { select { case <-this.closeSignal: break locp - case <-tc.C: + case <-timer.C: this.checkConfigure() } }