mirror of
https://github.com/minio/minio.git
synced 2025-11-10 22:10:12 -05:00
fix: protect updating latencies/throughput slices in obd (#10611)
Additionally close the transferChan upon function exit.
This commit is contained in:
@@ -27,9 +27,6 @@ import (
|
||||
"github.com/montanaflynn/stats"
|
||||
)
|
||||
|
||||
var globalLatency = map[string]Latency{}
|
||||
var globalThroughput = map[string]Throughput{}
|
||||
|
||||
// Latency holds latency information for write operations to the drive
|
||||
type Latency struct {
|
||||
Avg float64 `json:"avg_secs,omitempty"`
|
||||
@@ -154,6 +151,7 @@ func GetOBDInfo(ctx context.Context, drive, fsPath string) (Latency, Throughput,
|
||||
if minThroughput, err = stats.Min(throughputs); err != nil {
|
||||
return Latency{}, Throughput{}, err
|
||||
}
|
||||
|
||||
t := Throughput{
|
||||
Avg: avgThroughput,
|
||||
Percentile50: percentile50Throughput,
|
||||
@@ -163,8 +161,5 @@ func GetOBDInfo(ctx context.Context, drive, fsPath string) (Latency, Throughput,
|
||||
Max: maxThroughput,
|
||||
}
|
||||
|
||||
globalLatency[drive] = l
|
||||
globalThroughput[drive] = t
|
||||
|
||||
return l, t, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user