clean sendPriorityQueue even if there is no non-priority msg

This commit is contained in:
Diego 2024-01-31 12:13:54 +01:00
parent 362c94bf34
commit 4158849521
No known key found for this signature in database
GPG Key ID: C9DAC9BF68D1F806
1 changed files with 1 additions and 1 deletions

View File

@ -370,10 +370,10 @@ proc clearSendPriorityQueue(p: PubSubPeer) =
proc sendNonPriorityTask(p: PubSubPeer) {.async.} = proc sendNonPriorityTask(p: PubSubPeer) {.async.} =
while true: while true:
let msg = await p.rpcmessagequeue.nonPriorityQueue.popFirst()
while p.rpcmessagequeue.sendPriorityQueue.len > 0: while p.rpcmessagequeue.sendPriorityQueue.len > 0:
await p.rpcmessagequeue.sendPriorityQueue[0] await p.rpcmessagequeue.sendPriorityQueue[0]
p.clearSendPriorityQueue() p.clearSendPriorityQueue()
let msg = await p.rpcmessagequeue.nonPriorityQueue.popFirst()
when defined(libp2p_expensive_metrics): when defined(libp2p_expensive_metrics):
libp2p_gossipsub_non_priority_queue_size.dec(labelValues = [$p.peerId]) libp2p_gossipsub_non_priority_queue_size.dec(labelValues = [$p.peerId])
await p.sendMsg(msg) await p.sendMsg(msg)