Skip to content

Commit

Permalink
Hikari fix for sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
physcom committed Oct 23, 2023
1 parent 514e9a7 commit 08d98b3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import io.openfuture.chain.network.message.sync.GenesisBlockMessage
import io.openfuture.chain.network.service.NetworkApiService
import org.slf4j.Logger
import org.slf4j.LoggerFactory
//import org.springframework.boot.autoconfigure.jdbc.DataSourceSchemaCreatedEvent
import org.springframework.boot.context.event.ApplicationReadyEvent
import org.springframework.context.ApplicationListener
import org.springframework.context.event.EventListener
import org.springframework.stereotype.Component
Expand All @@ -43,8 +43,7 @@ class ChainSynchronizer(
private val dbChecker: DBChecker,
private val nodeConfigurator: NodeConfigurator,
private val syncSession: SyncSession
) {
//: ApplicationListener<DataSourceSchemaCreatedEvent> {
) : ApplicationListener<ApplicationReadyEvent> {

companion object {
private val log: Logger = LoggerFactory.getLogger(ChainSynchronizer::class.java)
Expand All @@ -58,9 +57,9 @@ class ChainSynchronizer(
fun forceSynchronizationCheck() {
checkLastBlock()
}
// override fun onApplicationEvent(event: DataSourceSchemaCreatedEvent) {
// prepareDB(nodeConfigurator.getConfig().mode)
// }
override fun onApplicationEvent(event: ApplicationReadyEvent) {
prepareDB(nodeConfigurator.getConfig().mode)
}

@EventListener
fun eventSyncMode(syncMode: SyncMode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class ChannelsHolder(
fun hasChannel(channel: Channel): Boolean = channelGroup.contains(channel)

fun findNewPeer() {
//log.info("PEER NUMBER: ${nodeProperties.peersNumber} and CHANNEL SIZE: ${channelGroup.size} and CONNECTION TASK : $connectionTask")
if (nodeProperties.peersNumber!! > channelGroup.size && (null == connectionTask || connectionTask!!.isDone)) {
connectionTask = executor.submit { findNewPeer0() }
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/application-chain-1.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ spring.datasource.driver-class-name=org.sqlite.JDBC
spring.datasource.url=jdbc:sqlite:./db/chain_1
spring.datasource.username=admin
spring.datasource.password=admin
spring.jpa.open-in-view=true
#spring.jpa.open-in-view=true
spring.jpa.database-platform=org.hibernate.dialect.SQLiteDialect
spring.jpa.hibernate.ddl-auto=update
#spring.jpa.hibernate.ddl-auto=update

# Logging
logging.level.io.openfuture.chain=INFO
Expand All @@ -15,6 +15,6 @@ server.port=8081

# NODE
node.port=9191
node.root-nodes=openchain:9192,openchain:9193
node.root-nodes=localhost:9192,localhost:9193

#node.config-path=config-1.json
node.config-path=config-1.json
8 changes: 4 additions & 4 deletions src/main/resources/application-chain-2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ spring.datasource.driver-class-name=org.sqlite.JDBC
spring.datasource.url=jdbc:sqlite:./db/chain_2
spring.datasource.username=admin
spring.datasource.password=admin
spring.jpa.open-in-view=true
#spring.jpa.open-in-view=true
spring.jpa.database-platform=org.hibernate.dialect.SQLiteDialect
spring.jpa.hibernate.ddl-auto=update
#spring.jpa.hibernate.ddl-auto=update

# Logging
logging.level.io.openfuture.chain=INFO
Expand All @@ -15,6 +15,6 @@ server.port=8082

# NODE
node.port=9192
node.root-nodes=openchain:9191,openchain:9193
node.root-nodes=localhost:9191,localhost:9193

#node.config-path=config-2.json
node.config-path=config-2.json
8 changes: 4 additions & 4 deletions src/main/resources/application-chain-3.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ spring.datasource.driver-class-name=org.sqlite.JDBC
spring.datasource.url=jdbc:sqlite:./db/chain_3
spring.datasource.username=admin
spring.datasource.password=admin
spring.jpa.open-in-view=true
#spring.jpa.open-in-view=true
spring.jpa.database-platform=org.hibernate.dialect.SQLiteDialect
spring.jpa.hibernate.ddl-auto=update
#spring.jpa.hibernate.ddl-auto=update

# Logging
logging.level.io.openfuture.chain=INFO
Expand All @@ -15,6 +15,6 @@ server.port=8083

# NODE
node.port=9193
node.root-nodes=openchain:9191,openchain:9192
node.root-nodes=localhost:9191,localhost:9192

#node.config-path=config-3.json
node.config-path=config-3.json
8 changes: 4 additions & 4 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ node.ntp-offset-threshold=1000
# CONSENSUS
consensus.epoch-height=21
consensus.delegates-count=3
consensus.block-capacity=10000
consensus.time-slot-duration=50000
consensus.time-slot-interval=15000
consensus.block-capacity=1000
consensus.time-slot-duration=5000
consensus.time-slot-interval=1500
consensus.genesis-address=0x0000000000000000000000000000000000000000
consensus.reward-block=10
consensus.fee-vote-tx-for=3
Expand All @@ -61,7 +61,7 @@ management.metrics.export.prometheus.step=15s
#spring.jpa.properties.hibernate.generate_statistics=true

### HIKARI
spring.datasource.hikari.maximum-pool-size=50
spring.datasource.hikari.maximum-pool-size=1
spring.datasource.hikari.connectionTimeout=30000
spring.datasource.hikari.idleTimeout=600000
spring.datasource.hikari.maxLifetime=1800000

0 comments on commit 08d98b3

Please sign in to comment.