watcher: handles stats resetting
This commit is contained in:
parent
3a10017590
commit
2f54f72499
@ -15,7 +15,7 @@ type WatchRunner interface {
|
||||
|
||||
// If the browser needs the watcher to be reset for each new event
|
||||
type ResetWatcher interface {
|
||||
ResetWatcher() // resets a new watcher
|
||||
ResetWatcher() error // resets a new watcher
|
||||
}
|
||||
|
||||
// Required interface to be implemented by browsers that want to use the
|
||||
@ -28,6 +28,11 @@ type Runner interface {
|
||||
Run()
|
||||
}
|
||||
|
||||
// interface for modules that keep stats
|
||||
type Stats interface {
|
||||
ResetStats()
|
||||
}
|
||||
|
||||
// Wrapper around fsnotify watcher
|
||||
type WatchDescriptor struct {
|
||||
ID string
|
||||
@ -148,10 +153,14 @@ func WatcherThread(w WatchRunner) {
|
||||
ch <- event
|
||||
} else {
|
||||
w.Run()
|
||||
if stats, ok := w.(Stats); ok {
|
||||
stats.ResetStats()
|
||||
}
|
||||
}
|
||||
|
||||
//log.Warningf("event: %v | eventName: %v", event.Op, event.Name)
|
||||
|
||||
//TODO!: remove condition and use interface instead
|
||||
if watched.ResetWatch {
|
||||
log.Debugf("resetting watchers")
|
||||
if r, ok := w.(ResetWatcher); ok {
|
||||
|
Loading…
Reference in New Issue
Block a user