Skip to content

Commit

Permalink
Fix request heap pop bug
Browse files Browse the repository at this point in the history
Missed in the changed interface from 6134708. Caused very poor performance. Thanks to @AskAlexSharov for raising the flag in #859 (comment).
  • Loading branch information
anacrolix committed Sep 11, 2023
1 parent 72c1152 commit 87f6cdc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion requesting.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func (p *Peer) applyRequestState(next desiredRequestState) {
originalRequestCount, p.needRequestUpdate))
}
for requestHeap.Len() != 0 && maxRequests(current.Requests.GetCardinality()+current.Cancelled.GetCardinality()) < p.nominalMaxRequests() {
req := requestHeap.Pop()
req := heap.Pop(requestHeap)
existing := t.requestingPeer(req)
if existing != nil && existing != p {
// Don't steal from the poor.
Expand Down

0 comments on commit 87f6cdc

Please sign in to comment.