Merge pull request #22753 from karalabe/p2p-tracker-stopfix

p2p/tracker: only reschedule wake if previous didn't run
This commit is contained in:
Péter Szilágyi 2021-04-27 21:49:54 +03:00 committed by GitHub
commit d9c9ee5ac9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -188,8 +188,9 @@ func (t *Tracker) Fulfil(peer string, version uint, code uint64, id uint64) {
t.expire.Remove(req.expire)
delete(t.pending, id)
if req.expire.Prev() == nil {
t.wake.Stop()
t.schedule()
if t.wake.Stop() {
t.schedule()
}
}
g := fmt.Sprintf("%s/%s/%d/%#02x", trackedGaugeName, t.protocol, req.version, req.reqCode)
metrics.GetOrRegisterGauge(g, nil).Dec(1)