[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: periodic scheduler skeleton
From: |
gnunet |
Subject: |
[libeufin] branch master updated: periodic scheduler skeleton |
Date: |
Fri, 29 May 2020 16:33:51 +0200 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new dd72cef periodic scheduler skeleton
dd72cef is described below
commit dd72cef18d93550605d7e3aa9346b6f2657c8a7f
Author: MS <ms@taler.net>
AuthorDate: Fri May 29 16:33:34 2020 +0200
periodic scheduler skeleton
---
nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index d9744f3..bf05df8 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -56,6 +56,8 @@ import io.ktor.server.netty.Netty
import io.ktor.utils.io.ByteReadChannel
import io.ktor.utils.io.jvm.javaio.toByteReadChannel
import io.ktor.utils.io.jvm.javaio.toInputStream
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.time.delay
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.transactions.transaction
import org.slf4j.Logger
@@ -66,6 +68,7 @@ import tech.libeufin.util.CryptoUtil.hashpw
import tech.libeufin.util.ebics_h004.HTDResponseOrderData
import java.lang.NumberFormatException
import java.net.URLEncoder
+import java.time.Duration
import java.util.*
import java.util.zip.InflaterInputStream
import javax.crypto.EncryptedPrivateKeyInfo
@@ -240,18 +243,29 @@ fun ApplicationRequest.hasBody(): Boolean {
return false
}
+
+suspend fun schedulePeriodicWork() {
+ while (true) {
+ delay(Duration.ofSeconds(1))
+ // download TWG C52
+ // ingest TWG new histories
+ logger.debug("I am scheduled")
+ }
+}
+
fun serverMain(dbName: String) {
dbCreateTables(dbName)
val client = HttpClient {
expectSuccess = false // this way, it does not throw exceptions on !=
200 responses.
}
val server = embeddedServer(Netty, port = 5001) {
-
+ launch {
+ schedulePeriodicWork()
+ }
install(CallLogging) {
this.level = Level.DEBUG
this.logger = tech.libeufin.nexus.logger
}
-
install(ContentNegotiation) {
jackson {
enable(SerializationFeature.INDENT_OUTPUT)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: periodic scheduler skeleton,
gnunet <=