Skip to content

Commit

Permalink
More logging
Browse files Browse the repository at this point in the history
  • Loading branch information
lavrov committed Sep 15, 2024
1 parent 826fc2d commit f03d4d5
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object RoutingTableBootstrap {
count <- resolveNodes(client, bootstrapNodeAddress).compile.count
_ <- logger.info(s"Pinged $count bootstrap nodes")
_ <- logger.info("Discover self to fill up routing table")
_ <- discovery.discover(InfoHash(client.id.bytes)).take(10).compile.drain
_ <- discovery.discover(InfoHash(client.id.bytes)).take(10).compile.drain.timeout(30.seconds).attempt
nodeCount <- table.allNodes.map(_.size)
_ <- logger.info(s"Bootstrapping finished with $nodeCount nodes")
} yield {}
Expand All @@ -51,10 +51,13 @@ object RoutingTableBootstrap {
)
.evalMap: ipAddress =>
val resolvedAddress = SocketAddress(ipAddress, hostname.port)
logger.info(s"Resolved to $ipAddress") *>
client
.ping(resolvedAddress)
.timeout(5.seconds)
.map(pong => NodeInfo(pong.id, resolvedAddress))
.flatTap: _ =>
logger.info(s"Reached $resolvedAddress node")
.map(_.some)
.recoverWith: e =>
logger.info(s"Failed to reach $resolvedAddress $e").as(none)
Expand Down

0 comments on commit f03d4d5

Please sign in to comment.