diff --git a/clients/config_client/config_client.go b/clients/config_client/config_client.go index 070a7924..a623278f 100644 --- a/clients/config_client/config_client.go +++ b/clients/config_client/config_client.go @@ -286,8 +286,8 @@ func (client *ConfigClient) ListenConfig(param vo.ConfigParam) (err error) { content string md5Str string ) - content, err = cache.ReadConfigFromFile(key, client.configCacheDir) - if err != nil { + content, fileErr := cache.ReadConfigFromFile(key, client.configCacheDir) + if fileErr != nil { logger.Errorf("[cache.ReadConfigFromFile] error: %+v", err) } if len(content) > 0 { diff --git a/clients/config_client/config_client_test.go b/clients/config_client/config_client_test.go index d7b047a0..3d58e715 100644 --- a/clients/config_client/config_client_test.go +++ b/clients/config_client/config_client_test.go @@ -612,7 +612,7 @@ func TestCancelListenConfig(t *testing.T) { key := util.GetConfigCacheKey(localConfigTest.DataId, localConfigTest.Group, clientConfigTest.NamespaceId) cache.WriteConfigToFile(key, client.configCacheDir, "") listenConfigParam := vo.ConfigParam{ - DataId: localConfigTest.DataId, + DataId: "cancel_listen_config", Group: localConfigTest.Group, OnChange: func(namespace, group, dataId, data string) { fmt.Println("group:" + group + ", dataId:" + dataId + ", data:" + data) @@ -625,7 +625,7 @@ func TestCancelListenConfig(t *testing.T) { assert.Nil(t, err) }() success, err := client.PublishConfig(vo.ConfigParam{ - DataId: localConfigTest.DataId, + DataId: "cancel_listen_config", Group: localConfigTest.Group, Content: localConfigTest.Content}) assert.Nil(t, err) @@ -639,7 +639,7 @@ func TestCancelListenConfig(t *testing.T) { client.CancelListenConfig(listenConfigParam) success, err = client.PublishConfig(vo.ConfigParam{ - DataId: localConfigTest.DataId, + DataId: "cancel_listen_config", Group: localConfigTest.Group, Content: "abcd"}) assert.Nil(t, err)