Skip to content

Commit

Permalink
Merge pull request #1076 from Cryptonomic/bugfix/resolved-caching-rac…
Browse files Browse the repository at this point in the history
…e-condition

Resolved race condition in metadata caching
  • Loading branch information
SiddharthV1 authored Jan 31, 2022
2 parents 0ce17a6 + 9b8cd65 commit 82b63b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
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

0 comments on commit 82b63b0

Please sign in to comment.