Skip to content

Commit

Permalink
clean sendPriorityQueue even if there is no non-priority msg
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomrsantos committed Jan 31, 2024
1 parent 833b6e0 commit 9fe2ec6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libp2p/protocols/pubsub/pubsubpeer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ proc clearSendPriorityQueue(p: PubSubPeer) =

proc sendNonPriorityTask(p: PubSubPeer) {.async.} =
while true:
let msg = await p.rpcmessagequeue.nonPriorityQueue.popFirst()
while p.rpcmessagequeue.sendPriorityQueue.len > 0:
await p.rpcmessagequeue.sendPriorityQueue[0]
p.clearSendPriorityQueue()

Check warning on line 375 in libp2p/protocols/pubsub/pubsubpeer.nim

View check run for this annotation

Codecov / codecov/patch

libp2p/protocols/pubsub/pubsubpeer.nim#L375

Added line #L375 was not covered by tests
let msg = await p.rpcmessagequeue.nonPriorityQueue.popFirst()
when defined(libp2p_expensive_metrics):
libp2p_gossipsub_non_priority_queue_size.dec(labelValues = [$p.peerId])
await p.sendMsg(msg)
Expand Down

0 comments on commit 9fe2ec6

Please sign in to comment.