Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache not working #692

Closed
zxc111 opened this issue Dec 5, 2023 · 0 comments
Closed

cache not working #692

zxc111 opened this issue Dec 5, 2023 · 0 comments

Comments

@zxc111
Copy link

zxc111 commented Dec 5, 2023

What version of nacos-sdk-go are you using?

2.2.4

What version of nacos-sever are you using?

2.2.0

What version of Go are you using (go version)?

1.19 or 1.21

What operating system (Linux, Windows, …) and version?

linux/mac

What did you do?

If possible, provide a recipe for reproducing the error.
dataID: test
namespace: public
value in nacos: 1

import (
	"testing"

	"github.com/nacos-group/nacos-sdk-go/v2/clients"
	"github.com/nacos-group/nacos-sdk-go/v2/common/constant"
	"github.com/nacos-group/nacos-sdk-go/v2/vo"
)

func TestGetConfig(t *testing.T) {
	cc := constant.ClientConfig{
		NamespaceId: "",
		Username:    "nacos",
		Password:    "nacos",
	}
	var sc []constant.ServerConfig
	sc = append(sc, *constant.NewServerConfig(
		"192.168.50.100",
		8848,
		constant.WithScheme("http"),
		constant.WithContextPath("/nacos"),
	))
	configClient, err := clients.NewConfigClient(
		vo.NacosClientParam{
			ClientConfig:  &cc,
			ServerConfigs: sc,
		},
	)
	if err != nil {
		t.Fatal(err)
	}
	for i := 0; i < 100; i++ {
		content, err := configClient.GetConfig(vo.ConfigParam{
			DataId: "test",
			Group:  "DEFAULT_GROUP"})
		t.Log(i, content)
		if content == "" {
			t.Fatal("empty")
		}
		if err != nil {
			t.Fatal(err)
		}
	}
}

err msg in nacos-sdk.log

2023-12-05T21:33:05.798+0800    ERROR   config_client/config_client.go:234  get config from server error:ConfigQueryRequest is limited, dataId=test, group=DEFAULT_GROUP, namespaceId=
2023-12-05T21:33:05.798+0800    WARN    config_client/config_client.go:247  read config from cache success, dataId=test, group=DEFAULT_GROUP, namespaceId=   

What did you expect to see?

run test all ok

What did you see instead?

get empty content when loop 5 times

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants