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!
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.watcha 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!