mirror of https://github.com/vacp2p/nim-libp2p.git
increase send timeout for prune and graft msgs (#306)
* increase send timeout for prune and graft msgs * use trace logs for subscribe monitor
This commit is contained in:
parent
980764774e
commit
b6877b8aac
|
@ -207,7 +207,8 @@ proc sendGraft*(p: PubSubPeer, topics: seq[string]) {.async.} =
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await p.send(RPCMsg(control: some(
|
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:
|
except CancelledError as exc:
|
||||||
raise exc
|
raise exc
|
||||||
except CatchableError as exc:
|
except CatchableError as exc:
|
||||||
|
@ -218,7 +219,8 @@ proc sendPrune*(p: PubSubPeer, topics: seq[string]) {.async.} =
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await p.send(RPCMsg(control: some(
|
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:
|
except CancelledError as exc:
|
||||||
raise exc
|
raise exc
|
||||||
except CatchableError as exc:
|
except CatchableError as exc:
|
||||||
|
|
|
@ -511,14 +511,14 @@ proc pubsubMonitor(s: Switch, peer: PeerInfo) {.async.} =
|
||||||
|
|
||||||
while s.isConnected(peer):
|
while s.isConnected(peer):
|
||||||
try:
|
try:
|
||||||
debug "subscribing to pubsub peer", peer = $peer
|
trace "subscribing to pubsub peer", peer = $peer
|
||||||
await s.subscribePeerInternal(peer)
|
await s.subscribePeerInternal(peer)
|
||||||
except CancelledError as exc:
|
except CancelledError as exc:
|
||||||
raise exc
|
raise exc
|
||||||
except CatchableError as exc:
|
except CatchableError as exc:
|
||||||
trace "exception in pubsub monitor", peer = $peer, exc = exc.msg
|
trace "exception in pubsub monitor", peer = $peer, exc = exc.msg
|
||||||
finally:
|
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
|
await sleepAsync(1.seconds) # allow the peer to cooldown
|
||||||
|
|
||||||
trace "exiting pubsub monitor", peer = $peer
|
trace "exiting pubsub monitor", peer = $peer
|
||||||
|
|
Loading…
Reference in New Issue