From b6877b8aac044d56551137a9618869387431eafc Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Mon, 3 Aug 2020 17:55:42 -0600 Subject: [PATCH] increase send timeout for prune and graft msgs (#306) * increase send timeout for prune and graft msgs * use trace logs for subscribe monitor --- libp2p/protocols/pubsub/pubsubpeer.nim | 6 ++++-- libp2p/switch.nim | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libp2p/protocols/pubsub/pubsubpeer.nim b/libp2p/protocols/pubsub/pubsubpeer.nim index 0b58614..1bbfdbc 100644 --- a/libp2p/protocols/pubsub/pubsubpeer.nim +++ b/libp2p/protocols/pubsub/pubsubpeer.nim @@ -207,7 +207,8 @@ proc sendGraft*(p: PubSubPeer, topics: seq[string]) {.async.} = try: await p.send(RPCMsg(control: some( - ControlMessage(graft: topics.mapIt(ControlGraft(topicID: it)))))) + ControlMessage(graft: topics.mapIt(ControlGraft(topicID: it))))), + timeout = 1.minutes) except CancelledError as exc: raise exc except CatchableError as exc: @@ -218,7 +219,8 @@ proc sendPrune*(p: PubSubPeer, topics: seq[string]) {.async.} = try: await p.send(RPCMsg(control: some( - ControlMessage(prune: topics.mapIt(ControlPrune(topicID: it)))))) + ControlMessage(prune: topics.mapIt(ControlPrune(topicID: it))))), + timeout = 1.minutes) except CancelledError as exc: raise exc except CatchableError as exc: diff --git a/libp2p/switch.nim b/libp2p/switch.nim index 254ee0c..30cc756 100644 --- a/libp2p/switch.nim +++ b/libp2p/switch.nim @@ -511,14 +511,14 @@ proc pubsubMonitor(s: Switch, peer: PeerInfo) {.async.} = while s.isConnected(peer): try: - debug "subscribing to pubsub peer", peer = $peer + trace "subscribing to pubsub peer", peer = $peer await s.subscribePeerInternal(peer) except CancelledError as exc: raise exc except CatchableError as exc: trace "exception in pubsub monitor", peer = $peer, exc = exc.msg finally: - debug "sleeping before trying pubsub peer", peer = $peer + trace "sleeping before trying pubsub peer", peer = $peer await sleepAsync(1.seconds) # allow the peer to cooldown trace "exiting pubsub monitor", peer = $peer