mirror of
https://github.com/pgsty/minio.git
synced 2026-09-25 20:35:58 +03:00
Add madmin package context support (#9172)
This is to improve responsiveness for all admin API operations and allowing callers to cancel any on-going admin operations, if they happen to be waiting too long.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
package madmin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@@ -32,15 +33,17 @@ type ServerUpdateStatus struct {
|
||||
|
||||
// ServerUpdate - updates and restarts the MinIO cluster to latest version.
|
||||
// optionally takes an input URL to specify a custom update binary link
|
||||
func (adm *AdminClient) ServerUpdate(updateURL string) (us ServerUpdateStatus, err error) {
|
||||
func (adm *AdminClient) ServerUpdate(ctx context.Context, updateURL string) (us ServerUpdateStatus, err error) {
|
||||
queryValues := url.Values{}
|
||||
queryValues.Set("updateURL", updateURL)
|
||||
|
||||
// Request API to Restart server
|
||||
resp, err := adm.executeMethod("POST", requestData{
|
||||
relPath: adminAPIPrefix + "/update",
|
||||
queryValues: queryValues,
|
||||
})
|
||||
resp, err := adm.executeMethod(ctx,
|
||||
http.MethodPost, requestData{
|
||||
relPath: adminAPIPrefix + "/update",
|
||||
queryValues: queryValues,
|
||||
},
|
||||
)
|
||||
defer closeResponse(resp)
|
||||
if err != nil {
|
||||
return us, err
|
||||
|
||||
Reference in New Issue
Block a user