From 9b9613cdbad954896f7cc996e5f21a252999f5df Mon Sep 17 00:00:00 2001 From: sanxun0325 Date: Sat, 3 Oct 2020 11:16:51 +0800 Subject: [PATCH] commit --- clients/config_client/config_client.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/clients/config_client/config_client.go b/clients/config_client/config_client.go index 8eb76ea1..070a7924 100644 --- a/clients/config_client/config_client.go +++ b/clients/config_client/config_client.go @@ -53,8 +53,8 @@ const ( var ( currentTaskCount int - cacheMap cache.ConcurrentMap - schedulerMap cache.ConcurrentMap + cacheMap = cache.NewConcurrentMap() + schedulerMap = cache.NewConcurrentMap() ) type cacheData struct { @@ -75,6 +75,11 @@ type cacheDataListener struct { lastMd5 string } +func init() { + schedulerMap.Set("root", true) + go delayScheduler(time.NewTimer(1*time.Millisecond), 10*time.Millisecond, "root", listenConfigExecutor()) +} + func NewConfigClient(nc nacos_client.INacosClient) (ConfigClient, error) { config := ConfigClient{} config.INacosClient = nc @@ -108,10 +113,6 @@ func NewConfigClient(nc nacos_client.INacosClient) (ConfigClient, error) { } config.kmsClient = kmsClient } - cacheMap = cache.NewConcurrentMap() - schedulerMap = cache.NewConcurrentMap() - schedulerMap.Set("root", true) - go delayScheduler(time.NewTimer(1*time.Millisecond), 10*time.Millisecond, "root", listenConfigExecutor()) return config, err }