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

Unnecessary call to getChildren? #1

Open
InfinitiesLoop opened this issue Mar 5, 2016 · 0 comments
Open

Unnecessary call to getChildren? #1

InfinitiesLoop opened this issue Mar 5, 2016 · 0 comments

Comments

@InfinitiesLoop
Copy link

If I understand correctly, this call to getChildren is not necessary:
https://github.com/yunong/node-leader/blob/master/election.js#L313

Because the call to self.watch a few lines later will do getChildren again anyway. It's normally harmless because the data will be the same each call, but they could be different, and I'm not sure if there's a scenario where that might cause some kind of race condition, like if children are changing frequently.

If this could potentially cause a problem I'd love to understand how, though. Hence I'm creating this issue instead of just fixing it. Perhaps it's solving a problem I hadn't thought of and isn't a mistake.

Thanks!

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

1 participant