p2p/tracker: fix head detection in Fulfil to avoid unnecessary timer reschedules (#33370)

This commit is contained in:
kurahin 2025-12-10 10:09:07 +02:00 committed by GitHub
parent 1ce71a1895
commit 13a8798fa3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -185,9 +185,10 @@ func (t *Tracker) Fulfil(peer string, version uint, code uint64, id uint64) {
return
}
// Everything matches, mark the request serviced and meter it
wasHead := req.expire.Prev() == nil
t.expire.Remove(req.expire)
delete(t.pending, id)
if req.expire.Prev() == nil {
if wasHead {
if t.wake.Stop() {
t.schedule()
}