Skip to content

Unnecessary call to getChildren? #1

@InfinitiesLoop

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!

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