go-zookeeper
go-zookeeper copied to clipboard
Add watcher type and the ability to remove watcher
camlistore.org/pkg/throttle
is broken, switched to go4.org/net/throttle
-
GetW
ExistsW
andChildrenW
return a*Watcher
at the position of<-chan Event
- The
watcher
could be removed(thus stopped) byConn.RemoveWatcher(watcher)
- The chan within a manually removed watcher will receive a special
Event with
ErrWatcherRemoved
-
WatchType
andWatchPathType
are exported
Does this have any chance to be merged ? Is there something we can do to help get it merged ?
I'm not sure if @samuel is still maintaining this repo. You can just use the fork (as I did) for now. @cerisier
Does this have any chance to be merged ? Is there something we can do to help get it merged ?
I used this library in my project, which caused a memory leak. The pprof file shows that addwatcher () takes up too much memory, so I want to use removeaddwatcher (). Have you actually used the PR code? My project is https://github.com/apache/dubbo-go,Looking forward to communicating with you
I found the same problem from my source code
//conn.go line 950
c.watchersLock.Lock()
defer c.watchersLock.Unlock()
ch := make(chan Event, 1) //canot remove. caused memory leak
wpt := watchPathType{path, watchType}
c.watchers[wpt] = append(c.watchers[wpt], ch)
@samuel