From df0b98bfdde25d297650517a40519436db7c22b8 Mon Sep 17 00:00:00 2001 From: Diego Date: Fri, 9 Feb 2024 16:14:00 +0100 Subject: [PATCH] dont add finished future --- libp2p/protocols/pubsub/pubsubpeer.nim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libp2p/protocols/pubsub/pubsubpeer.nim b/libp2p/protocols/pubsub/pubsubpeer.nim index ddc97d43c..bb4d4f6c9 100644 --- a/libp2p/protocols/pubsub/pubsubpeer.nim +++ b/libp2p/protocols/pubsub/pubsubpeer.nim @@ -287,9 +287,11 @@ proc sendEncoded*(p: PubSubPeer, msg: seq[byte], isHighPriority: bool = false) { return if isHighPriority: - p.rpcmessagequeue.sendPriorityQueue.addLast(p.sendMsg(msg)) - when defined(libp2p_expensive_metrics): - libp2p_gossipsub_priority_queue_size.inc(labelValues = [$p.peerId]) + let f = p.sendMsg(msg) + if not f.finished: + p.rpcmessagequeue.sendPriorityQueue.addLast(f) + when defined(libp2p_expensive_metrics): + libp2p_gossipsub_priority_queue_size.inc(labelValues = [$p.peerId]) else: await p.rpcmessagequeue.nonPriorityQueue.addLast(msg) when defined(libp2p_expensive_metrics):