mirror of
https://github.com/minio/minio.git
synced 2025-11-09 21:49:46 -05:00
implement configurable timeout for OBD tests (#9324)
This commit is contained in:
@@ -21,7 +21,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
@@ -52,8 +51,7 @@ type Throughput struct {
|
||||
}
|
||||
|
||||
// GetOBDInfo about the drive
|
||||
func GetOBDInfo(ctx context.Context, drive string, fsPath string) (Latency, Throughput, error) {
|
||||
runtime.LockOSThread()
|
||||
func GetOBDInfo(ctx context.Context, drive, fsPath string) (Latency, Throughput, error) {
|
||||
|
||||
// Create a file with O_DIRECT flag, choose default umask and also make sure
|
||||
// we are exclusively writing to a new file using O_EXCL.
|
||||
@@ -96,8 +94,6 @@ func GetOBDInfo(ctx context.Context, drive string, fsPath string) (Latency, Thro
|
||||
latencies[i] = float64(latencyInSecs)
|
||||
}
|
||||
|
||||
runtime.UnlockOSThread()
|
||||
|
||||
for i := range latencies {
|
||||
throughput := float64(blockSize) / latencies[i]
|
||||
throughputs[i] = throughput
|
||||
|
||||
@@ -221,11 +221,14 @@ var OBDDataTypesList = []OBDDataType{
|
||||
|
||||
// ServerOBDInfo - Connect to a minio server and call OBD Info Management API
|
||||
// to fetch server's information represented by OBDInfo structure
|
||||
func (adm *AdminClient) ServerOBDInfo(ctx context.Context, obdDataTypes []OBDDataType) <-chan OBDInfo {
|
||||
func (adm *AdminClient) ServerOBDInfo(ctx context.Context, obdDataTypes []OBDDataType, deadline time.Duration) <-chan OBDInfo {
|
||||
respChan := make(chan OBDInfo)
|
||||
go func() {
|
||||
v := url.Values{}
|
||||
|
||||
v.Set("deadline",
|
||||
deadline.Truncate(1*time.Second).String())
|
||||
|
||||
// start with all set to false
|
||||
for _, d := range OBDDataTypesList {
|
||||
v.Set(string(d), "false")
|
||||
|
||||
Reference in New Issue
Block a user