Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Add watcher type and the ability to remove watcher #110

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tevino
Copy link

@tevino tevino commented Apr 11, 2016

camlistore.org/pkg/throttle is broken, switched to go4.org/net/throttle


  1. GetW ExistsW and ChildrenW return a *Watcher at the position of <-chan Event
  2. The watcher could be removed(thus stopped) by Conn.RemoveWatcher(watcher)
  3. The chan within a manually removed watcher will receive a special
    Event with ErrWatcherRemoved
  4. WatchType and WatchPathType are exported

@tevino tevino force-pushed the watcher branch 9 times, most recently from 1c5ed88 to 8d659ee Compare April 11, 2016 09:51
1. GetW ExistsW and ChildrenW return a *Watcher at the position of <-chan Event
2. The watcher could be removed(thus stopped) by Conn.RemoveWatcher(watcher)
3. The chan within a manually removed watcher will receive a special
   Event with ErrWatcherRemoved
4. WatchType and WatchPathType are exported
camlistore.org/pkg/throttle is broken, switched to go4.org/net/throttle
@cerisier
Copy link

cerisier commented May 5, 2016

Does this have any chance to be merged ? Is there something we can do to help get it merged ?

@tevino
Copy link
Author

tevino commented May 6, 2016

I'm not sure if @samuel is still maintaining this repo.
You can just use the fork (as I did) for now. @cerisier

@pantianying
Copy link

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

@wanyvic
Copy link

wanyvic commented Mar 4, 2020

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants