Although get a EOF error, we should still know it

This commit is contained in:
boxjan 2021-04-09 21:45:52 +08:00
parent fa9ef78362
commit 8449c1e2e9

View file

@ -157,11 +157,9 @@ func (client *s3Client) removeObjects(bucketName, prefix string) error {
errorCh := client.minio.RemoveObjects(client.ctx, bucketName, objectsCh, opts) errorCh := client.minio.RemoveObjects(client.ctx, bucketName, objectsCh, opts)
haveErrWhenRemoveObjects := false haveErrWhenRemoveObjects := false
for e := range errorCh { for e := range errorCh {
if e.Err.Error() != "EOF" {
glog.Errorf("Failed to remove object %s, error: %s", e.ObjectName, e.Err) glog.Errorf("Failed to remove object %s, error: %s", e.ObjectName, e.Err)
haveErrWhenRemoveObjects = true haveErrWhenRemoveObjects = true
} }
}
if haveErrWhenRemoveObjects { if haveErrWhenRemoveObjects {
return fmt.Errorf("Failed to remove all objects of bucket %s", bucketName) return fmt.Errorf("Failed to remove all objects of bucket %s", bucketName)
} }
@ -212,11 +210,9 @@ func (client *s3Client) removeObjectsOneByOne(bucketName, prefix string) error {
haveErrWhenRemoveObjects := false haveErrWhenRemoveObjects := false
for e := range removeErrCh { for e := range removeErrCh {
if e.Err.Error() != "EOF" {
glog.Errorf("Failed to remove object %s, error: %s", e.ObjectName, e.Err) glog.Errorf("Failed to remove object %s, error: %s", e.ObjectName, e.Err)
haveErrWhenRemoveObjects = true haveErrWhenRemoveObjects = true
} }
}
if haveErrWhenRemoveObjects { if haveErrWhenRemoveObjects {
return fmt.Errorf("Failed to remove all objects of path %s", bucketName) return fmt.Errorf("Failed to remove all objects of path %s", bucketName)
} }