mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
fix: close http body for es action (#18491)
This commit is contained in:
parent
a4cfb5e1ed
commit
41091d9472
@ -34,7 +34,7 @@ import (
|
||||
elasticsearch7 "github.com/elastic/go-elasticsearch/v7"
|
||||
"github.com/minio/highwayhash"
|
||||
"github.com/minio/minio/internal/event"
|
||||
xioutil "github.com/minio/minio/internal/ioutil"
|
||||
xhttp "github.com/minio/minio/internal/http"
|
||||
"github.com/minio/minio/internal/logger"
|
||||
"github.com/minio/minio/internal/once"
|
||||
"github.com/minio/minio/internal/store"
|
||||
@ -475,7 +475,7 @@ func (c *esClientV7) createIndex(args ElasticsearchArgs) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer xioutil.DiscardReader(resp.Body)
|
||||
defer xhttp.DrainBody(resp.Body)
|
||||
if resp.IsError() {
|
||||
return fmt.Errorf("Create index err: %v", res)
|
||||
}
|
||||
@ -491,7 +491,7 @@ func (c *esClientV7) ping(ctx context.Context, _ ElasticsearchArgs) (bool, error
|
||||
if err != nil {
|
||||
return false, store.ErrNotConnected
|
||||
}
|
||||
xioutil.DiscardReader(resp.Body)
|
||||
xhttp.DrainBody(resp.Body)
|
||||
return !resp.IsError(), nil
|
||||
}
|
||||
|
||||
@ -504,7 +504,7 @@ func (c *esClientV7) entryExists(ctx context.Context, index string, key string)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
xioutil.DiscardReader(res.Body)
|
||||
xhttp.DrainBody(res.Body)
|
||||
return !res.IsError(), nil
|
||||
}
|
||||
|
||||
@ -519,7 +519,7 @@ func (c *esClientV7) removeEntry(ctx context.Context, index string, key string)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer xioutil.DiscardReader(res.Body)
|
||||
defer xhttp.DrainBody(res.Body)
|
||||
if res.IsError() {
|
||||
return fmt.Errorf("Delete err: %s", res.String())
|
||||
}
|
||||
@ -547,7 +547,7 @@ func (c *esClientV7) updateEntry(ctx context.Context, index string, key string,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer xioutil.DiscardReader(res.Body)
|
||||
defer xhttp.DrainBody(res.Body)
|
||||
if res.IsError() {
|
||||
return fmt.Errorf("Update err: %s", res.String())
|
||||
}
|
||||
@ -573,7 +573,7 @@ func (c *esClientV7) addEntry(ctx context.Context, index string, eventData event
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer xioutil.DiscardReader(res.Body)
|
||||
defer xhttp.DrainBody(res.Body)
|
||||
if res.IsError() {
|
||||
return fmt.Errorf("Add err: %s", res.String())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user