Add polling as a fallback to native filesystem events in server watch

Fixes #8720
Fixes #6849
Fixes #7930
This commit is contained in:
Bjørn Erik Pedersen
2021-07-02 09:54:03 +02:00
parent 0019d60f67
commit 24ce98b6d1
8 changed files with 731 additions and 13 deletions

View File

@@ -0,0 +1,20 @@
// Package filenotify is adapted from https://github.com/moby/moby/tree/master/pkg/filenotify, Apache-2.0 License.
// Hopefully this can be replaced with an external package sometime in the future, see https://github.com/fsnotify/fsnotify/issues/9
package filenotify
import "github.com/fsnotify/fsnotify"
// fsNotifyWatcher wraps the fsnotify package to satisfy the FileNotifier interface
type fsNotifyWatcher struct {
*fsnotify.Watcher
}
// Events returns the fsnotify event channel receiver
func (w *fsNotifyWatcher) Events() <-chan fsnotify.Event {
return w.Watcher.Events
}
// Errors returns the fsnotify error channel receiver
func (w *fsNotifyWatcher) Errors() <-chan error {
return w.Watcher.Errors
}