Skip to content

Commit 7455462

Browse files
kurahinucwong
authored andcommitted
p2p/tracker: fix head detection in Fulfil to avoid unnecessary timer reschedules (#33370)
1 parent 6be1d43 commit 7455462

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

p2p/tracker/tracker.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,10 @@ func (t *Tracker) Fulfil(peer string, version uint, code uint64, id uint64) {
185185
return
186186
}
187187
// Everything matches, mark the request serviced and meter it
188+
wasHead := req.expire.Prev() == nil
188189
t.expire.Remove(req.expire)
189190
delete(t.pending, id)
190-
if req.expire.Prev() == nil {
191+
if wasHead {
191192
if t.wake.Stop() {
192193
t.schedule()
193194
}

0 commit comments

Comments
 (0)