all: Add filesystem notification support
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3986
This commit is contained in:
committed by
Audrius Butkevicius
parent
c704ba9ef9
commit
f98c21b68e
@@ -34,11 +34,20 @@ func (f *sendOnlyFolder) Serve() {
|
||||
f.scan.timer.Stop()
|
||||
}()
|
||||
|
||||
if f.FSWatcherEnabled {
|
||||
f.startWatcher()
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-f.ctx.Done():
|
||||
return
|
||||
|
||||
case <-f.ignoresUpdated:
|
||||
if f.FSWatcherEnabled {
|
||||
f.restartWatcher()
|
||||
}
|
||||
|
||||
case <-f.scan.timer.C:
|
||||
l.Debugln(f, "Scanning subdirectories")
|
||||
f.scanTimerFired()
|
||||
@@ -48,6 +57,10 @@ func (f *sendOnlyFolder) Serve() {
|
||||
|
||||
case next := <-f.scan.delay:
|
||||
f.scan.timer.Reset(next)
|
||||
|
||||
case fsEvents := <-f.watchChan:
|
||||
l.Debugln(f, "filesystem notification rescan")
|
||||
f.scanSubdirs(fsEvents)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user