Skip to content

Commit 14a814b

Browse files
committed
sidetransport: remove a call to timeutil.Now()
This removes an extra call to timeutil.Now(). Just something I noticed when reading the code. timeutil.Unit() should be able to use the monotonic clock if `by` has a monotonic clock reading already which is also nice. It might be nice to make a version of the pacer that can use crtime.Mono but that is a larger change. Epic: none Release note: None
1 parent 44eef4b commit 14a814b

File tree

1 file changed

+4
-2
lines changed
  • pkg/kv/kvserver/closedts/sidetransport

1 file changed

+4
-2
lines changed

pkg/kv/kvserver/closedts/sidetransport/sender.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,10 @@ func (b *updatesBuf) PaceBroadcastUpdate(ctx context.Context, condVar *sync.Cond
697697
}
698698
b.mu.Unlock()
699699

700-
if workLeft > 0 && timeutil.Now().Before(by) {
701-
time.Sleep(by.Sub(timeutil.Now()))
700+
if workLeft > 0 {
701+
if wait := timeutil.Until(by); wait > 0 {
702+
time.Sleep(wait)
703+
}
702704
}
703705
}
704706
}

0 commit comments

Comments
 (0)