Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
storage: ignore key not found error when deleting files
Browse files Browse the repository at this point in the history
Signed-off-by: huanghaoyuanhhy <[email protected]>
  • Loading branch information
huanghaoyuanhhy committed Apr 1, 2024
1 parent 658b5fa commit 262282c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion storage/minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"strings"

"github.com/minio/minio-go/v7"
)
Expand Down Expand Up @@ -97,7 +98,10 @@ func (m *MinioClient) DeleteObjects(ctx context.Context, i DeleteObjectsInput) e
job := func(ctx context.Context) error {
// we can't use RemoveObjects, because gcp doesn't support batch delete
if err := m.cli.RemoveObject(ctx, i.Bucket, key, minio.RemoveObjectOptions{}); err != nil {
return fmt.Errorf("storage: %s delete prefix remove key: %s %w", m.provider, key, err)
if !strings.Contains(err.Error(), "The specified key does not exist") {
// if key not exist, we can ignore it
return fmt.Errorf("storage: %s delete prefix remove key: %s %w", m.provider, key, err)
}
}

return nil
Expand Down

0 comments on commit 262282c

Please sign in to comment.