fix: move verification time logging outside loop and only record average
This commit is contained in:
parent
0b000bfc89
commit
dd9fdabf47
|
@ -68,8 +68,6 @@ func (v *Verifier) Read(p []byte) (int, error) {
|
||||||
|
|
||||||
timeEnd := time.Now()
|
timeEnd := time.Now()
|
||||||
v.verifyTime += timeEnd.Sub(timeStart)
|
v.verifyTime += timeEnd.Sub(timeStart)
|
||||||
averageVerifyTime := v.verifyTime / time.Duration(v.read/VERIFY_CHUNK_SIZE)
|
|
||||||
v.logger.Debug("Verification time", zap.Duration("duration", timeEnd.Sub(timeStart)), zap.Duration("average", averageVerifyTime))
|
|
||||||
|
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
// If EOF, break the loop as no more data can be read
|
// If EOF, break the loop as no more data can be read
|
||||||
|
@ -77,6 +75,9 @@ func (v *Verifier) Read(p []byte) (int, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
averageVerifyTime := v.verifyTime / time.Duration(v.read/VERIFY_CHUNK_SIZE)
|
||||||
|
v.logger.Debug("Verification time", zap.Duration("average", averageVerifyTime))
|
||||||
|
|
||||||
// Attempt to read the remainder of the data from the buffer
|
// Attempt to read the remainder of the data from the buffer
|
||||||
additionalBytes, _ := v.buffer.Read(p[n:])
|
additionalBytes, _ := v.buffer.Read(p[n:])
|
||||||
return n + additionalBytes, nil
|
return n + additionalBytes, nil
|
||||||
|
|
Loading…
Reference in New Issue