[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] 01/02: fix resource leak
From: |
gnunet |
Subject: |
[libeufin] 01/02: fix resource leak |
Date: |
Sat, 13 Jun 2020 10:13:31 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository libeufin.
commit e5321b21a819cafe59250ea5f83185ffc9c33eff
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Sat Jun 13 13:42:01 2020 +0530
fix resource leak
---
nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index dc811d8..bfa2ee9 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -260,14 +260,14 @@ fun ApplicationRequest.hasBody(): Boolean {
return false
}
-fun moreFrequentBackgroundTasks() {
+fun moreFrequentBackgroundTasks(httpClient: HttpClient) {
GlobalScope.launch {
while (true) {
logger.debug("More frequent background job")
ingestTalerTransactions()
submitPreparedPaymentsViaEbics()
try {
- downloadTalerFacadesTransactions("C52")
+ downloadTalerFacadesTransactions(httpClient,"C52")
} catch (e: Exception) {
val sw = StringWriter()
val pw = PrintWriter(sw)
@@ -279,12 +279,12 @@ fun moreFrequentBackgroundTasks() {
}
}
-fun lessFrequentBackgroundTasks() {
+fun lessFrequentBackgroundTasks(httpClient: HttpClient) {
GlobalScope.launch {
while (true) {
logger.debug("Less frequent background job")
try {
- downloadTalerFacadesTransactions("C53")
+ downloadTalerFacadesTransactions(httpClient,"C53")
} catch (e: Exception) {
val sw = StringWriter()
val pw = PrintWriter(sw)
@@ -297,8 +297,7 @@ fun lessFrequentBackgroundTasks() {
}
/** Crawls all the facades, and requests history for each of its creators. */
-suspend fun downloadTalerFacadesTransactions(type: String) {
- val httpClient = HttpClient()
+suspend fun downloadTalerFacadesTransactions(httpClient: HttpClient, type:
String) {
val work = mutableListOf<Pair<String, String>>()
transaction {
TalerFacadeStateEntity.all().forEach {
@@ -449,8 +448,8 @@ fun serverMain(dbName: String) {
return@intercept
}
- lessFrequentBackgroundTasks()
- moreFrequentBackgroundTasks()
+ lessFrequentBackgroundTasks(client)
+ moreFrequentBackgroundTasks(client)
routing {
/**
* Shows information about the requesting user.
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.