Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved race condition in metadata caching #1076

Merged
merged 1 commit into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ import tech.cryptonomic.conseil.api.routes.Docs
import tech.cryptonomic.conseil.api.routes.info.AppInfo
import tech.cryptonomic.conseil.api.routes.platform.data.ApiDataRoutes
import tech.cryptonomic.conseil.api.routes.platform.data.bitcoin.{BitcoinDataOperations, BitcoinDataRoutes}
import tech.cryptonomic.conseil.api.routes.platform.data.ethereum.{
EthereumDataOperations,
EthereumDataRoutes,
QuorumDataRoutes
}
import tech.cryptonomic.conseil.api.routes.platform.data.ethereum.{EthereumDataOperations, EthereumDataRoutes, QuorumDataRoutes}
import tech.cryptonomic.conseil.api.routes.platform.data.tezos.{TezosDataOperations, TezosDataRoutes}
import tech.cryptonomic.conseil.api.routes.platform.discovery.{GenericPlatformDiscoveryOperations, PlatformDiscovery}
import tech.cryptonomic.conseil.api.security.Security
Expand All @@ -31,10 +27,9 @@ import tech.cryptonomic.conseil.common.config.Platforms.BlockchainPlatform
import tech.cryptonomic.conseil.common.io.Logging.ConseilLogSupport
import tech.cryptonomic.conseil.common.sql.DatabaseRunner

import scala.concurrent.ExecutionContext
import scala.concurrent.duration.DurationInt
import scala.concurrent.{Await, ExecutionContext}
import scala.concurrent.duration.{Duration, DurationInt}
import scala.util.{Failure, Success}

import cats.effect.unsafe.implicits.global

object ConseilApi {
Expand Down Expand Up @@ -228,7 +223,7 @@ class ConseilApi(config: CombinedConfiguration)(implicit system: ActorSystem)
} yield platform -> network

if (visibleNetworks.nonEmpty) { // At least one blockchain is enabled
cachedDiscoveryOperations.init(visibleNetworks).onComplete {
Await.ready(cachedDiscoveryOperations.init(visibleNetworks), Duration.Inf).onComplete {
case Failure(exception) => logger.error("Pre-caching metadata failed", exception)
case Success(_) => logger.info("Pre-caching successful!")
}
Expand Down
1 change: 0 additions & 1 deletion conseil-common/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ platforms: [
baker-rolls-size: 8000
baker-rolls-size: ${?CONSEIL_XTZ_BACKER_ROLLS_SIZE}

network: "mainnet"
network: "granadanet"
network: ${?CONSEIL_XTZ_NETWORK}

Expand Down