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: endpoint automatically discovered through Consul is not effective #1043

Closed
wants to merge 1 commit into from

Conversation

Meepoljdx
Copy link
Contributor

#1041 fix

@kongfei605
Copy link
Collaborator

kongfei605 commented Sep 5, 2024

这个修改不对哈。 一个思路是time.After 分支内,err不为nil时直接return。 但是这个改法有个问题,那就是会把采集周期拉长到interval+consul refresh interval 。

所以比较合适的一个方案是在instance init的时候,直接启动一个goroutine 定时刷新consul service url, gather的时候,只需要获取一下这些url就可以了。 启动的goroutine 需要在Drop的时候退出,也就是会走 ctx.Done的那个分支。

@kongfei605
Copy link
Collaborator

Thank you @Meepoljdx all the same.

@kongfei605 kongfei605 closed this Sep 5, 2024
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