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
@@ -164,6 +164,10 @@ func (f *sendReceiveFolder) Serve() {
|
||||
var prevSec int64
|
||||
var prevIgnoreHash string
|
||||
|
||||
if f.FSWatcherEnabled {
|
||||
f.startWatcher()
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-f.ctx.Done():
|
||||
@@ -174,6 +178,12 @@ func (f *sendReceiveFolder) Serve() {
|
||||
f.pullTimer.Reset(0)
|
||||
l.Debugln(f, "remote index updated, rescheduling pull")
|
||||
|
||||
case <-f.ignoresUpdated:
|
||||
if f.FSWatcherEnabled {
|
||||
f.restartWatcher()
|
||||
}
|
||||
f.IndexUpdated()
|
||||
|
||||
case <-f.pullTimer.C:
|
||||
select {
|
||||
case <-f.initialScanFinished:
|
||||
@@ -278,6 +288,10 @@ func (f *sendReceiveFolder) 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