set metric to zero when cleaning non prio queue

This commit is contained in:
Diego 2024-04-10 12:39:11 +02:00
parent 0c61f12b85
commit 917dbf83cd
No known key found for this signature in database
GPG Key ID: C9DAC9BF68D1F806
1 changed files with 4 additions and 3 deletions

View File

@ -278,6 +278,9 @@ proc clearNonPriorityQueue*(p: PubSubPeer) =
if len(p.rpcmessagequeue.nonPriorityQueue) > 0:
p.rpcmessagequeue.nonPriorityQueue.clear()
when defined(pubsubpeer_queue_metrics):
libp2p_gossipsub_non_priority_queue_size.set(labelValues = [$p.peerId], value = 0)
proc sendMsgContinue(conn: Connection, msgFut: Future[void]) {.async.} =
# Continuation for a pending `sendMsg` future from below
try:
@ -465,11 +468,9 @@ proc stopSendNonPriorityTask*(p: PubSubPeer) =
p.rpcmessagequeue.sendNonPriorityTask.cancelSoon()
p.rpcmessagequeue.sendNonPriorityTask = nil
p.rpcmessagequeue.sendPriorityQueue.clear()
p.clearNonPriorityQueue()
when defined(pubsubpeer_queue_metrics):
libp2p_gossipsub_priority_queue_size.set(labelValues = [$p.peerId], value = 0)
libp2p_gossipsub_non_priority_queue_size.set(labelValues = [$p.peerId], value = 0)
p.clearNonPriorityQueue()
proc new(T: typedesc[RpcMessageQueue]): T =
return T(