go-zookeeper / zk

Native ZooKeeper client for Go
BSD 3-Clause "New" or "Revised" License
504 stars 130 forks source link

ChildrenW returns a wrong EventType #109

Open BarkunMaxim opened 1 year ago

BarkunMaxim commented 1 year ago

When we listen to node using childrenW method We have two cases:

  1. node Parent with children's nodes [child1, child2, child3]. if I try to delete the node Parent, I get event.Type = EventNodeChildrenChanged.

  2. node Parent without children's nodes. if I try to delete the node Parent, I get event.Type = EventNodeDeleted.

It looks like a bug. In the first case I expected to get event.Type = EventNodeDeleted

Example of getting events:

go func() {
        for {
            select {
            case <-ctx.Done():
                return
            case ev := <-events:

                fmt.Println(ev.Type)

                _, _, events, err = client.conn.ChildrenW(path)

            }
        }
    }()