mirror of
https://codeberg.org/scip/io-exporter.git
synced 2025-12-16 20:11:00 +01:00
fix #6: do not report elapsed time on failure
This commit is contained in:
@@ -78,6 +78,11 @@ func (exp *Exporter) measure(mode int) Result {
|
||||
now := time.Now()
|
||||
elapsed := float64(now.Sub(start).Nanoseconds()) / 10000000000
|
||||
|
||||
// makes no sense to measure latency if operation failed
|
||||
if !result {
|
||||
elapsed = 0
|
||||
}
|
||||
|
||||
return Result{elapsed: elapsed, result: result}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user