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:config groutine(watch) leak #1327

Merged
merged 3 commits into from
Aug 13, 2021
Merged

fix:config groutine(watch) leak #1327

merged 3 commits into from
Aug 13, 2021

Conversation

daemon365
Copy link
Member

Description (what this PR does / why we need it):

Which issue(s) this PR fixes:

fixes #

Other special notes for reviewer:

code :

go c.watch(w)

@codecov-commenter
Copy link

codecov-commenter commented Aug 12, 2021

Codecov Report

Merging #1327 (65e8b78) into main (55cf830) will decrease coverage by 0.19%.
The diff coverage is 37.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1327      +/-   ##
==========================================
- Coverage   60.49%   60.30%   -0.20%     
==========================================
  Files          59       59              
  Lines        2739     2751      +12     
==========================================
+ Hits         1657     1659       +2     
- Misses        937      946       +9     
- Partials      145      146       +1     
Impacted Files Coverage Δ
config/config.go 54.66% <0.00%> (-2.28%) ⬇️
config/env/watcher.go 38.46% <37.50%> (-24.04%) ⬇️
config/file/watcher.go 59.37% <60.00%> (-1.34%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 55cf830...65e8b78. Read the comment docs.

@daemon365 daemon365 changed the title fix:config groutine(watch) leak" fix:config groutine(watch) leak Aug 13, 2021
config/config.go Outdated
@@ -65,6 +66,10 @@ func New(opts ...Option) Config {
func (c *config) watch(w Watcher) {
for {
kvs, err := w.Next()
if err == context.Canceled {
Copy link
Member

Choose a reason for hiding this comment

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

是不是应该用标准库的errors.Is 判断比较好?

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

@tonybase tonybase merged commit fdce5f0 into go-kratos:main Aug 13, 2021
@daemon365 daemon365 deleted the config_watcher branch August 13, 2021 06:12
zouyx pushed a commit to zouyx/kratos that referenced this pull request Aug 24, 2021
* fix:config goroutine(watch) Leak
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.

4 participants