fix: compilation issue when `libp2p_expensive_metrics` is enabled. (#1014)
This commit is contained in:
parent
9468bb6b4d
commit
d46bcdb6ac
|
@ -426,6 +426,11 @@ method rpcHandler*(g: GossipSub,
|
|||
await rateLimit(g, peer, Opt.none(RPCMsg), msgSize)
|
||||
return
|
||||
|
||||
when defined(libp2p_expensive_metrics):
|
||||
for m in rpcMsg.messages:
|
||||
for t in m.topicIDs:
|
||||
libp2p_pubsub_received_messages.inc(labelValues = [$peer.peerId, t])
|
||||
|
||||
trace "decoded msg from peer", peer, msg = rpcMsg.shortLog
|
||||
await rateLimit(g, peer, Opt.some(rpcMsg), msgSize)
|
||||
|
||||
|
|
|
@ -138,12 +138,6 @@ proc handle*(p: PubSubPeer, conn: Connection) {.async.} =
|
|||
conn, peer = p, closed = conn.closed,
|
||||
data = data.shortLog
|
||||
|
||||
when defined(libp2p_expensive_metrics):
|
||||
for m in rmsg.messages:
|
||||
for t in m.topicIDs:
|
||||
# metrics
|
||||
libp2p_pubsub_received_messages.inc(labelValues = [$p.peerId, t])
|
||||
|
||||
await p.handler(p, data)
|
||||
data = newSeq[byte]() # Release memory
|
||||
except PeerRateLimitError as exc:
|
||||
|
|
Loading…
Reference in New Issue