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:
Dmitriy Ryajov 2020-08-03 17:55:42 -06:00 committed by GitHub
parent 980764774e
commit b6877b8aac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -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:

View File

@ -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