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:
Harshavardhana
2020-03-20 15:00:44 -07:00
committed by GitHub
parent 1ffa983a9d
commit ae654831aa
47 changed files with 398 additions and 213 deletions

View File

@@ -20,6 +20,7 @@
package main
import (
"context"
"io"
"log"
"os"
@@ -45,7 +46,7 @@ func main() {
profiler := madmin.ProfilerCPU
log.Println("Starting " + profiler + " profiling..")
startResults, err := madmClnt.StartProfiling(profiler)
startResults, err := madmClnt.StartProfiling(context.Background(), profiler)
if err != nil {
log.Fatalln(err)
}
@@ -63,7 +64,7 @@ func main() {
log.Println("Stopping profiling..")
profilingData, err := madmClnt.DownloadProfilingData()
profilingData, err := madmClnt.DownloadProfilingData(context.Background())
if err != nil {
log.Fatalln(err)
}