We never need to treat these as warnings from a scan. Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
+16
-3
@@ -267,9 +267,22 @@ func (w *walker) scan(ctx context.Context, toHashChan chan<- protocol.FileInfo,
|
|||||||
// isWarnableError returns true if err is a kind of error we should warn
|
// isWarnableError returns true if err is a kind of error we should warn
|
||||||
// about receiving from the folder walk.
|
// about receiving from the folder walk.
|
||||||
func isWarnableError(err error) bool {
|
func isWarnableError(err error) bool {
|
||||||
return err != nil &&
|
switch {
|
||||||
!errors.Is(err, fs.SkipDir) && // intentional skip
|
case err == nil:
|
||||||
!errors.Is(err, context.Canceled) // folder restarting
|
return false
|
||||||
|
case errors.Is(err, fs.SkipDir):
|
||||||
|
// intentional skip
|
||||||
|
return false
|
||||||
|
case errors.Is(err, context.Canceled):
|
||||||
|
// folder restarting
|
||||||
|
return false
|
||||||
|
case fs.IsNotExist(err):
|
||||||
|
// sudden does-not-exist is fine for deleted files, deleted folder
|
||||||
|
// root triggers health check error instead
|
||||||
|
return false
|
||||||
|
default:
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *walker) walkAndHashFiles(ctx context.Context, toHashChan chan<- protocol.FileInfo, finishedChan chan<- ScanResult) fs.WalkFunc {
|
func (w *walker) walkAndHashFiles(ctx context.Context, toHashChan chan<- protocol.FileInfo, finishedChan chan<- ScanResult) fs.WalkFunc {
|
||||||
|
|||||||
Reference in New Issue
Block a user