diff options
author | ms <ms@taler.net> | 2021-03-25 10:21:56 +0100 |
---|---|---|
committer | ms <ms@taler.net> | 2021-03-25 10:21:56 +0100 |
commit | b4b71a4064b6b2e220b5d2cd333ebf9475fcd85d (patch) | |
tree | 1e38b829f4254a98f1ce0ba3bc67b6935591c6af /nexus | |
parent | be29b5b4861b56e916b8671ee7a62d69c41523c8 (diff) | |
download | libeufin-b4b71a4064b6b2e220b5d2cd333ebf9475fcd85d.tar.gz libeufin-b4b71a4064b6b2e220b5d2cd333ebf9475fcd85d.tar.bz2 libeufin-b4b71a4064b6b2e220b5d2cd333ebf9475fcd85d.zip |
Delaying scheduled tasks detection.
That used to happen before the responsible database
tables got completely created, resulting in many database
errors due to a non existent table.
Diffstat (limited to 'nexus')
-rw-r--r-- | nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 3 | ||||
-rw-r--r-- | nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt | 11 |
2 files changed, 8 insertions, 6 deletions
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt index 81ed7871..4927b10a 100644 --- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt +++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt @@ -34,7 +34,9 @@ import com.github.ajalt.clikt.parameters.types.int import execThrowableOrTerminate import com.github.ajalt.clikt.core.* import com.github.ajalt.clikt.parameters.options.versionOption +import io.ktor.client.* import tech.libeufin.nexus.iso20022.parseCamtMessage +import tech.libeufin.nexus.server.client import tech.libeufin.util.* import java.io.File @@ -60,6 +62,7 @@ class Serve : CliktCommand("Run nexus HTTP server") { override fun run() { setLogLevel(logLevel) serverMain(getDbConnFromEnv(NEXUS_DB_ENV_VAR_NAME), host, port) + startOperationScheduler(client) } } diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt index 90c6f813..737912d4 100644 --- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt +++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt @@ -183,13 +183,14 @@ fun requireBankConnection(call: ApplicationCall, parameterKey: String): NexusBan return requireBankConnectionInternal(name) } +val client = HttpClient { + expectSuccess = false // this way, it does not throw exceptions on != 200 responses. +} + fun serverMain(dbName: String, host: String, port: Int) { execThrowableOrTerminate { dbCreateTables(dbName) } - val client = HttpClient { - expectSuccess = false // this way, it does not throw exceptions on != 200 responses. - } val server = embeddedServer(Netty, port = port, host = host) { install(CallLogging) { this.level = Level.DEBUG @@ -251,8 +252,6 @@ fun serverMain(dbName: String, host: String, port: Int) { return@intercept finish() } } - - startOperationScheduler(client) routing { get("/config") { call.respond( @@ -1065,4 +1064,4 @@ fun serverMain(dbName: String, host: String, port: Int) { logger.error(e.message) exitProcess(1) } -} +}
\ No newline at end of file |