diff options
| author | chrislu <chris.lu@gmail.com> | 2025-11-05 13:10:58 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-11-05 13:10:58 -0800 |
| commit | 636540aba2ba4256a8dc99f493490dd641510d67 (patch) | |
| tree | 20e932eda4a444ca121edb7725f69ad032b22325 | |
| parent | 671de48369eb051632b5714b9895c77a881530d2 (diff) | |
| download | seaweedfs-636540aba2ba4256a8dc99f493490dd641510d67.tar.xz seaweedfs-636540aba2ba4256a8dc99f493490dd641510d67.zip | |
handle listing errors
| -rw-r--r-- | weed/s3api/filer_util.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/weed/s3api/filer_util.go b/weed/s3api/filer_util.go index 161570e01..a456ed611 100644 --- a/weed/s3api/filer_util.go +++ b/weed/s3api/filer_util.go @@ -3,10 +3,11 @@ package s3api import ( "context" "fmt" - "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants" "math" "strings" + "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants" + "github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" "github.com/seaweedfs/seaweedfs/weed/util" @@ -114,7 +115,7 @@ func (s3a *S3ApiServer) updateEntriesTTL(parentDirectoryPath string, ttlSec int3 var updateErrors []error err := s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { ctx := context.Background() - _ = filer_pb.SeaweedList(ctx, client, parentDirectoryPath, "", func(entry *filer_pb.Entry, isLast bool) error { + if listErr := filer_pb.SeaweedList(ctx, client, parentDirectoryPath, "", func(entry *filer_pb.Entry, isLast bool) error { if entry.IsDirectory { if err := s3a.updateEntriesTTL(fmt.Sprintf("%s/%s", strings.TrimRight(parentDirectoryPath, "/"), entry.Name), ttlSec); err != nil { updateErrors = append(updateErrors, fmt.Errorf("dir %s: %w", entry.Name, err)) @@ -139,7 +140,9 @@ func (s3a *S3ApiServer) updateEntriesTTL(parentDirectoryPath string, ttlSec int3 updateErrors = append(updateErrors, fmt.Errorf("file %s: %w", entry.Name, err)) } return nil - }, "", false, math.MaxInt32) + }, "", false, math.MaxInt32); listErr != nil { + return fmt.Errorf("list entries in %s: %w", parentDirectoryPath, listErr) + } if len(updateErrors) > 0 { return fmt.Errorf("failed to update %d entries: %v", len(updateErrors), updateErrors[0]) } |
