mirror of https://github.com/minio/minio.git
fix: timeN function return final closure not be called (#21615)
VulnCheck / Analysis (push) Has been cancelled
Details
VulnCheck / Analysis (push) Has been cancelled
Details
This commit is contained in:
parent
b8631cf531
commit
534f4a9fb1
|
@ -106,16 +106,14 @@ func (p *scannerMetrics) log(s scannerMetric, paths ...string) func(custom map[s
|
||||||
|
|
||||||
// time n scanner actions.
|
// time n scanner actions.
|
||||||
// Use for s < scannerMetricLastRealtime
|
// Use for s < scannerMetricLastRealtime
|
||||||
func (p *scannerMetrics) timeN(s scannerMetric) func(n int) func() {
|
func (p *scannerMetrics) timeN(s scannerMetric) func(n int) {
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
return func(n int) func() {
|
return func(n int) {
|
||||||
return func() {
|
duration := time.Since(startTime)
|
||||||
duration := time.Since(startTime)
|
|
||||||
|
|
||||||
atomic.AddUint64(&p.operations[s], uint64(n))
|
atomic.AddUint64(&p.operations[s], uint64(n))
|
||||||
if s < scannerMetricLastRealtime {
|
if s < scannerMetricLastRealtime {
|
||||||
p.latency[s].add(duration)
|
p.latency[s].add(duration)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue