[skip ci]Fix golint warnings in timerecord (#9104)

Signed-off-by: Xiangyu Wang <xiangyu.wang@zilliz.com>
This commit is contained in:
Xiangyu Wang 2021-10-03 00:53:55 +08:00 committed by GitHub
parent 02b2f3c88b
commit 71b7e768e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,7 @@ import (
"github.com/milvus-io/milvus/internal/log"
)
// TimeRecorder provides methods to record time duration
type TimeRecorder struct {
header string
start time.Time
@ -33,6 +34,7 @@ func NewTimeRecorder(header string) *TimeRecorder {
}
}
// RecordSpan return the duration from last record
func (tr *TimeRecorder) RecordSpan() time.Duration {
curr := time.Now()
span := curr.Sub(tr.last)
@ -40,6 +42,7 @@ func (tr *TimeRecorder) RecordSpan() time.Duration {
return span
}
// ElapseSpan return the duration from the beginning
func (tr *TimeRecorder) ElapseSpan() time.Duration {
curr := time.Now()
span := curr.Sub(tr.start)