python-zk / kazoo

Kazoo is a high-level Python library that makes it easier to use Apache Zookeeper.
https://kazoo.readthedocs.io
Apache License 2.0
1.3k stars 387 forks source link

ChildrenWatch events are missing the name of the changed node #459

Open mskucherawy opened 7 years ago

mskucherawy commented 7 years ago

Using kazoo-2.3.1 I register a ChildrenWatch on a node and set "event=True". My callback is hit right away with a "None" event and the list of children. So far so good.

Now when the callback is hit again, the WatchedEvent I receive doesn't tell me what child node caused the callback to get hit. Are we supposed to keep the list from one callback to the next and identify changes ourselves? Under 2.0 with recursive watchers we used to be able to tell which node was the reason for the callback and what happened to it.

The watcher is set with:

self.kazoo.ChildrenWatch('(the-watched-path-here)', func=callback, send_event=True)

Other than the first call, my callback's "event" parameter comes in looking like:

WatchedEvent(type='CHILD', state='CONNECTED', path='(the-watched-path-here)')