lib/model, lib/nat: More service termination speedup (#5884)

This commit is contained in:
Simon Frei
2019-07-23 10:49:22 +02:00
committed by GitHub
parent 15c262184b
commit 942659fb06
2 changed files with 21 additions and 3 deletions

View File

@@ -423,6 +423,12 @@ func (f *folder) scanSubdirs(subDirs []string) error {
var iterError error
f.fset.WithPrefixedHaveTruncated(protocol.LocalDeviceID, sub, func(fi db.FileIntf) bool {
select {
case <-f.ctx.Done():
return false
default:
}
file := fi.(db.FileInfoTruncated)
if err := batch.flushIfFull(); err != nil {
@@ -507,6 +513,12 @@ func (f *folder) scanSubdirs(subDirs []string) error {
return true
})
select {
case <-f.ctx.Done():
return f.ctx.Err()
default:
}
if iterError == nil && len(toIgnore) > 0 {
for _, file := range toIgnore {
l.Debugln("marking file as ignored", f)