From 023e4842b6d7502bf2b397bc30eaf1d084e94401 Mon Sep 17 00:00:00 2001 From: sanxun0325 Date: Tue, 13 Oct 2020 11:16:58 +0800 Subject: [PATCH] Listening configuration increases the namespace --- clients/config_client/config_client.go | 2 +- clients/config_client/config_proxy.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/clients/config_client/config_client.go b/clients/config_client/config_client.go index a623278f..22c6f65e 100644 --- a/clients/config_client/config_client.go +++ b/clients/config_client/config_client.go @@ -392,7 +392,7 @@ func longPulling(taskId int) func() error { params[constant.KEY_LISTEN_CONFIGS] = listeningConfigs var changed string - changedTmp, err := client.configProxy.ListenConfig(params, len(initializationList) > 0, clientConfig.AccessKey, clientConfig.SecretKey) + changedTmp, err := client.configProxy.ListenConfig(params, len(initializationList) > 0, clientConfig.NamespaceId, clientConfig.AccessKey, clientConfig.SecretKey) if err == nil { changed = changedTmp } else { diff --git a/clients/config_client/config_proxy.go b/clients/config_client/config_proxy.go index 0ef02874..b30542ae 100644 --- a/clients/config_client/config_proxy.go +++ b/clients/config_client/config_proxy.go @@ -128,7 +128,7 @@ func (cp *ConfigProxy) DeleteConfigProxy(param vo.ConfigParam, tenant, accessKey } } -func (cp *ConfigProxy) ListenConfig(params map[string]string, isInitializing bool, accessKey, secretKey string) (string, error) { +func (cp *ConfigProxy) ListenConfig(params map[string]string, isInitializing bool, tenant, accessKey, secretKey string) (string, error) { //fixed at 30000ms,avoid frequent request on the server var listenInterval uint64 = 30000 headers := map[string]string{ @@ -141,6 +141,10 @@ func (cp *ConfigProxy) ListenConfig(params map[string]string, isInitializing boo headers["accessKey"] = accessKey headers["secretKey"] = secretKey + + if len(tenant) > 0 { + params["tenant"] = tenant + } logger.Infof("[client.ListenConfig] request params:%+v header:%+v \n", params, headers) // In order to prevent the server from handling the delay of the client's long task, // increase the client's read timeout to avoid this problem.