From f0e58fa80432c6d63eb9709b19d58e1db6b36643 Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Wed, 27 May 2015 22:46:10 +0100 Subject: [PATCH] Additional cases for detecting folders disappearing --- internal/model/model.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/internal/model/model.go b/internal/model/model.go index 1f4daf10d..6a9a82dce 100644 --- a/internal/model/model.go +++ b/internal/model/model.go @@ -1303,6 +1303,7 @@ nextSub: batch = batch[:0] // TODO: We should limit the Have scanning to start at sub seenPrefix := false + var iterError error fs.WithHaveTruncated(protocol.LocalDeviceID, func(fi db.FileIntf) bool { f := fi.(db.FileInfoTruncated) hasPrefix := len(subs) == 0 @@ -1326,6 +1327,10 @@ nextSub: } if len(batch) == batchSizeFiles { + if err := m.CheckFolderHealth(folder); err != nil { + iterError = err + return false + } m.updateLocals(folder, batch) batch = batch[:0] } @@ -1363,7 +1368,16 @@ nextSub: } return true }) - if len(batch) > 0 { + + if iterError != nil { + l.Infof("Stopping folder %s mid-scan due to folder error: %s", folder, iterError) + return iterError + } + + if err := m.CheckFolderHealth(folder); err != nil { + l.Infof("Stopping folder %s mid-scan due to folder error: %s", folder, err) + return err + } else if len(batch) > 0 { m.updateLocals(folder, batch) }