Skip to content

Unnecessary call to getChildren? #1

Description

@InfinitiesLoop

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions