Skip to content

Commit 2b4e439

Browse files
mohansonseankhliao
authored andcommitted
rate: use time.Time.Equal instead of ==
According to the Time Type documentation, in most cases, it is better to use Equal instead of == Change-Id: I201de68ee163a06cf9ed49f7b77a2de031dbdd95 Reviewed-on: https://go-review.googlesource.com/c/time/+/703175 Reviewed-by: Michael Knyszek <[email protected]> Reviewed-by: Florian Lehner <[email protected]> Reviewed-by: Sean Liao <[email protected]> Reviewed-by: Mark Freeman <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent c0b0320 commit 2b4e439

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rate/rate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ func (r *Reservation) CancelAt(t time.Time) {
195195
// update state
196196
r.lim.last = t
197197
r.lim.tokens = tokens
198-
if r.timeToAct == r.lim.lastEvent {
198+
if r.timeToAct.Equal(r.lim.lastEvent) {
199199
prevEvent := r.timeToAct.Add(r.limit.durationFromTokens(float64(-r.tokens)))
200200
if !prevEvent.Before(t) {
201201
r.lim.lastEvent = prevEvent

0 commit comments

Comments
 (0)