diff --git a/libp2p/protocols/pubsub/pubsubpeer.nim b/libp2p/protocols/pubsub/pubsubpeer.nim index 245731a6de..645aa9e531 100644 --- a/libp2p/protocols/pubsub/pubsubpeer.nim +++ b/libp2p/protocols/pubsub/pubsubpeer.nim @@ -58,7 +58,7 @@ type Ttlmessage* = object msg*: seq[byte] - ttl*: Moment + timestamp*: Moment RpcMessageQueue* = ref object sendPriorityQueue: Deque[Future[void]] @@ -298,7 +298,7 @@ proc sendEncoded*(p: PubSubPeer, msg: seq[byte], isHighPriority: bool = false) { when defined(libp2p_expensive_metrics): libp2p_gossipsub_priority_queue_size.inc(labelValues = [$p.peerId]) else: - await p.rpcmessagequeue.nonPriorityQueue.addLast(Ttlmessage(msg: msg, ttl: Moment.now())) + await p.rpcmessagequeue.nonPriorityQueue.addLast(Ttlmessage(msg: msg, timestamp: Moment.now())) when defined(libp2p_expensive_metrics): libp2p_gossipsub_non_priority_queue_size.inc(labelValues = [$p.peerId]) trace "message queued", p, msg = shortLog(msg) @@ -385,7 +385,7 @@ proc sendNonPriorityTask(p: PubSubPeer) {.async.} = let ttlMsg = await p.rpcmessagequeue.nonPriorityQueue.popFirst() when defined(libp2p_expensive_metrics): libp2p_gossipsub_non_priority_queue_size.dec(labelValues = [$p.peerId]) - if Moment.now() - ttlMsg.ttl >= p.rpcmessagequeue.maxDurationInNonPriorityQueue: + if Moment.now() - ttlMsg.timestamp >= p.rpcmessagequeue.maxDurationInNonPriorityQueue: when defined(libp2p_expensive_metrics): libp2p_gossipsub_non_priority_msgs_dropped.inc(labelValues = [$p.peerId]) continue