should use time.Since instead of time.Now().Sub

Signed-off-by: wgliang <liangcszzu@163.com>
This commit is contained in:
wangguoliang 2017-09-07 18:00:45 +08:00
parent 70f3d1e9f9
commit 7e6c6020ff

View File

@ -255,7 +255,7 @@ func (s *memorySeries) maybeCloseHeadChunk(timeout time.Duration) (bool, error)
if s.headChunkClosed {
return false, nil
}
if time.Now().Sub(s.lastTime.Time()) > timeout {
if time.Since(s.lastTime.Time()) > timeout {
s.headChunkClosed = true
// Since we cannot modify the head chunk from now on, we
// don't need to bother with cloning anymore.