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

clientv3: non-recursive Watch() #11922

Merged
merged 1 commit into from
May 21, 2020
Merged

Conversation

tedyu
Copy link
Contributor

@tedyu tedyu commented May 20, 2020

Currently watcher#Watch() is recursive.

This PR replaces the recursion with a for loop.
Prior to the PR,

	close(closeCh)

is placed at the end of Watch().
For recursion involving Watch(), the above code is not executed, except for the most deeply nested Watch(). Meaning closeCh is not closed.

This bug is fixed with this PR

@tedyu tedyu changed the title clientv3: non-recursive watch clientv3: non-recursive Watch() May 20, 2020
@tedyu
Copy link
Contributor Author

tedyu commented May 20, 2020

@gyuho @spzala
This PR fixes unclosed closeCh when recursion is involved.

@gyuho
Copy link
Contributor

gyuho commented May 20, 2020

@tedyu Thanks for the PR. Now the watch code is easier to read :)

@tedyu tedyu force-pushed the non-recursive-watch branch from 4695dcf to acda472 Compare May 20, 2020 22:22
@tedyu tedyu force-pushed the non-recursive-watch branch from acda472 to f1e26c6 Compare May 20, 2020 22:39
@tedyu tedyu force-pushed the non-recursive-watch branch from f1e26c6 to f976138 Compare May 20, 2020 22:44
@gyuho
Copy link
Contributor

gyuho commented May 20, 2020

lgtm

@tedyu
Copy link
Contributor Author

tedyu commented May 21, 2020

@gyuho
Can this be merged ?

Copy link
Contributor

@gyuho gyuho left a comment

Choose a reason for hiding this comment

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

lgtm thx!

@gyuho gyuho merged commit a4ada8c into etcd-io:master May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants