Merge pull request #371 from cute-angelia/main

fix minio removeobjects
jc/alimy
北野 - Michael Li 1 year ago committed by GitHub
commit 0f2e0b2407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -134,13 +134,16 @@ func (s *minioServant) DeleteObject(objectKey string) error {
func (s *minioServant) DeleteObjects(objectKeys []string) (err error) {
objectsCh := make(chan minio.ObjectInfo, len(objectKeys))
resCh := s.client.RemoveObjects(context.Background(), s.bucket, objectsCh, minio.RemoveObjectsOptions{})
for _, objectKey := range objectKeys {
objectsCh <- minio.ObjectInfo{
Key: objectKey,
go func() {
defer close(objectsCh)
for _, objectKey := range objectKeys {
objectsCh <- minio.ObjectInfo{
Key: objectKey,
}
}
}
}()
resCh := s.client.RemoveObjects(context.Background(), s.bucket, objectsCh, minio.RemoveObjectsOptions{})
// 宽松处理所有错误,只记录最后一次发生的错误
for result := range resCh {
if result.Err != nil {

Loading…
Cancel
Save