chore: don't log non-error message at error level

When walking the tree for creating the search index, ignore "not found"
errors. Search indexing happens asynchronously so the underlying space,
file or folder might just not exist anymore when the indexing starts.
This commit is contained in:
Ralf Haferkamp
2026-07-08 12:09:17 +02:00
committed by Ralf Haferkamp
parent 0245a2197b
commit c8805265e2

View File

@@ -2,6 +2,7 @@ package search
import (
"context"
"errors"
"fmt"
"path/filepath"
"sort"
@@ -487,6 +488,12 @@ func (s *Service) IndexSpace(spaceID *provider.StorageSpaceId, forceRescan bool)
}()
err = w.Walk(ownerCtx, &rootID, func(wd string, info *provider.ResourceInfo, err error) error {
if err != nil {
var notFoundErr errtypes.IsNotFound
if errors.As(err, &notFoundErr) {
// The resource disappeared while walking the tree. E.g. the underlying file/directory/space
// might just have been deleted meanwhile. We can just ignore this error.
return nil
}
s.logger.Error().Err(err).Msg("error walking the tree")
return err
}