From 9fe2ec6fc7498d4b353f3dcb39de583e2e13a91e Mon Sep 17 00:00:00 2001 From: Diego Date: Wed, 31 Jan 2024 12:13:54 +0100 Subject: [PATCH] clean sendPriorityQueue even if there is no non-priority msg --- libp2p/protocols/pubsub/pubsubpeer.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libp2p/protocols/pubsub/pubsubpeer.nim b/libp2p/protocols/pubsub/pubsubpeer.nim index 2cde3ce308..ab3d9070e8 100644 --- a/libp2p/protocols/pubsub/pubsubpeer.nim +++ b/libp2p/protocols/pubsub/pubsubpeer.nim @@ -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() + 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)