mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-08 17:03:09 +00:00
refactor(networking): wait for all futures together in connectToNodes (#1471)
* refactor(networking): wait for all futures together in connectToNodes * refactor(networking): await fix style
This commit is contained in:
parent
2e92c4f31a
commit
37973586a9
@ -269,10 +269,13 @@ proc connectToNodes*(pm: PeerManager,
|
||||
source = "api") {.async.} =
|
||||
info "connectToNodes", len = nodes.len
|
||||
|
||||
var futConns: seq[Future[Option[Connection]]]
|
||||
for node in nodes:
|
||||
let node = when node is string: parseRemotePeerInfo(node)
|
||||
else: node
|
||||
discard await pm.dialPeer(RemotePeerInfo(node), proto, dialTimeout, source)
|
||||
futConns.add(pm.dialPeer(RemotePeerInfo(node), proto, dialTimeout, source))
|
||||
|
||||
await allFutures(futConns)
|
||||
|
||||
# The issue seems to be around peers not being fully connected when
|
||||
# trying to subscribe. So what we do is sleep to guarantee nodes are
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user