wait for non-priority msg first before checking the priority queue
This commit is contained in:
parent
a1f3940c06
commit
20a8e57262
|
@ -372,11 +372,11 @@ proc clearSendPriorityQueue(p: PubSubPeer) =
|
||||||
|
|
||||||
proc sendNonPriorityTask(p: PubSubPeer) {.async.} =
|
proc sendNonPriorityTask(p: PubSubPeer) {.async.} =
|
||||||
while true:
|
while true:
|
||||||
|
# we send non-priority messages only if there are no pending priority messages
|
||||||
|
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()
|
||||||
# we send non-priority messages only if there are no pending priority messages
|
|
||||||
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)
|
||||||
|
|
Loading…
Reference in New Issue