Skip to content

Commit

Permalink
fix entities cache
Browse files Browse the repository at this point in the history
  • Loading branch information
redroy44 committed Jun 10, 2021
1 parent 3fcf82e commit 07237b6
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 2 deletions.
96 changes: 96 additions & 0 deletions config.conf
@@ -0,0 +1,96 @@
include required("/Users/pbandurski/repos/cryptonomic/Conseil/conseil-api/src/main/resources/developer.conf")

logging: {
muted: false
loggers: [
{
name: "org.http4s",
level: "INFO"
},
{
name: "slick",
level: "INFO"
}
{
name: "com.zaxxer.hikari"
level: "INFO"
}
]
}

# Settings for blockchains Conseil can connect to. Nested by blockchain name and network.
platforms: [
{
name: "tezos"
network: "mainnet"
enabled: true

node: {
protocol: "http"
hostname: "localhost"
port: 8732
path-prefix: ""
}
},
{
name: "ethereum"
network: "mainnet"
enabled: true
node: "http://localhost:8545"

retry {
max-wait: 2s
max-retry: 5
}

batching {
indexer-threads-count: 8
http-fetch-threads-count: 8
blocks-batch-size: 10
transactions-batch-size: 100
contracts-batch-size: 100
tokens-batch-size: 100
}
},
{
name: "bitcoin"
network: "mainnet"
enabled: true

node: {
protocol: "http"
hostname: "localhost"
port: 8332
username: "ubuntu"
password: "6w27fca8NvreVxQnwgRJwt8BzKwdYxfK"
}

batching {
indexer-threads-count: 8
http-fetch-threads-count: 8
hash-batch-size: 2000
blocks-batch-size: 500
transactions-batch-size: 500
}
}
]

conseil {
hostname: "localhost"
port: 1337

security.api-keys.keys: ["conseil"]

db {
dataSourceClass = "org.postgresql.ds.PGSimpleDataSource"
properties {
user = "conseil"
password = "password"
url = "jdbc:postgresql://localhost:55432/conseil"
}
numThreads = 20
maxConnections = 20
}
}

lorre.db = ${conseil.db}
Expand Up @@ -30,7 +30,7 @@ class MetadataService(

private val entities = {
def futureEntities(path: NetworkPath): List[Entity] =
Await.result(platformDiscoveryOperations.getEntities(path), 5 second)
Await.result(platformDiscoveryOperations.getEntities(path), 10 second)

networks.values.flatten
.map(_.path)
Expand Down
Expand Up @@ -191,7 +191,7 @@ class GenericPlatformDiscoveryOperations(
updatedEntities <- IO.fromFuture(
IO(dbRunner.runQuery(preCacheEntities(networkPath.up.platform, networkPath.network)))
)
_ <- caching.putAllEntities(updatedEntities)
_ <- caching.putEntities(key, updatedEntities(key).value)
} yield ()).unsafeRunAsyncAndForget()
IO.pure(ent)
}
Expand Down
1 change: 1 addition & 0 deletions conseil-regression-tests.conf
@@ -0,0 +1 @@
conseil.security.api-keys.keys = ["hooman"]

0 comments on commit 07237b6

Please sign in to comment.