dont add finished future

This commit is contained in:
Diego 2024-02-09 16:14:00 +01:00
parent 451637a644
commit df0b98bfdd
No known key found for this signature in database
GPG Key ID: C9DAC9BF68D1F806
1 changed files with 5 additions and 3 deletions

View File

@ -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):