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

fix: get error resolver when user uses different nacos in few seconds #108

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Skyenought
Copy link
Member

What type of PR is this?

fix

What this PR does / why we need it (English/Chinese):

在之前的 Name() 实现中return 的是一个常量, 在使用不同配置的 nacos 的默认情况下
uniqueKey := cacheKey(config.Resolver.Name(), config.Balancer.Name(), config.LbOpts)
会在短时间取到相同的结果

于是现在添加 timestamp 作为唯一标识, 防止出现取到错误数据

Which issue(s) this PR fixes:

#107

group: "DEFAULT_GROUP",
cluster: "DEFAULT",
group: "DEFAULT_GROUP",
timestamp: time.Now().String(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接使用时间戳构造唯一 key,在业务滥用 resolver 初始化时会在存在 goroutine 的泄露的问题,需要根据业务场景具体情况具体看了。
image

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

Successfully merging this pull request may close these issues.

2 participants