fix minio removeobjects

pull/371/head
cute-angelia 1 year ago
parent c1a7597328
commit 7a479e2ed4

@ -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{})
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