Browse Source

add callbackErr in ListDirectoryEntries

pull/7485/head
Roman Tamarov 2 weeks ago
parent
commit
4101d34010
  1. 6
      weed/filer/redis3/universal_redis_store.go

6
weed/filer/redis3/universal_redis_store.go

@ -140,6 +140,7 @@ func (store *UniversalRedis3Store) ListDirectoryEntries(ctx context.Context, dir
dirListKey := genDirectoryListKey(string(dirPath))
counter := int64(0)
var callbackErr error
err = listChildren(ctx, store, dirListKey, startFileName, func(fileName string) bool {
if startFileName != "" {
if !includeStartFile && startFileName == fileName {
@ -168,6 +169,7 @@ func (store *UniversalRedis3Store) ListDirectoryEntries(ctx context.Context, dir
resEachEntryFunc, resEachEntryFuncErr := eachEntryFunc(entry)
if resEachEntryFuncErr != nil {
glog.V(0).InfofCtx(ctx, "failed to process eachEntryFunc for entry %q: %w", entry.Name(), resEachEntryFuncErr)
callbackErr = resEachEntryFuncErr
return false
}
@ -182,6 +184,10 @@ func (store *UniversalRedis3Store) ListDirectoryEntries(ctx context.Context, dir
return true
})
if callbackErr != nil {
return lastFileName, fmt.Errorf("failed to process eachEntryFunc: %w", callbackErr)
}
return lastFileName, err
}

Loading…
Cancel
Save