[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] 02/02: indentation
From: |
gnunet |
Subject: |
[libeufin] 02/02: indentation |
Date: |
Wed, 05 Apr 2023 12:47:45 +0200 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
commit ba7537287a34d5e82925d7e3df8f377cddd1addb
Author: MS <ms@taler.net>
AuthorDate: Wed Apr 5 12:47:38 2023 +0200
indentation
---
nexus/src/main/kotlin/tech/libeufin/nexus/Scheduling.kt | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Scheduling.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/Scheduling.kt
index 2d3d869e..0dcea820 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Scheduling.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Scheduling.kt
@@ -25,18 +25,15 @@ import com.cronutils.parser.CronParser
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import io.ktor.client.HttpClient
import kotlinx.coroutines.*
-import kotlinx.coroutines.GlobalScope.coroutineContext
import kotlinx.coroutines.time.delay
import org.jetbrains.exposed.sql.transactions.transaction
import tech.libeufin.nexus.bankaccount.fetchBankAccountTransactions
import tech.libeufin.nexus.bankaccount.submitAllPaymentInitiations
import tech.libeufin.nexus.server.FetchSpecJson
import java.lang.IllegalArgumentException
-import java.net.ConnectException
import java.time.Duration
import java.time.Instant
import java.time.ZonedDateTime
-import kotlin.coroutines.coroutineContext
import kotlin.system.exitProcess
private data class TaskSchedule(
@@ -118,15 +115,14 @@ suspend fun startOperationScheduler(httpClient:
HttpClient) {
NexusScheduledTaskEntity.find {
NexusScheduledTasksTable.nextScheduledExecutionSec.isNull()
}.forEach {
- val cron = try {
- NexusCron.parser.parse(it.taskCronspec)
- } catch (e: IllegalArgumentException) {
+ val cron = try { NexusCron.parser.parse(it.taskCronspec) }
+ catch (e: IllegalArgumentException) {
logger.error("invalid cronspec in schedule
${it.resourceType}/${it.resourceId}/${it.taskName}")
return@forEach
}
val zonedNow = ZonedDateTime.now()
- val et = ExecutionTime.forCron(cron)
- val next = et.nextExecution(zonedNow)
+ val parsedCron = ExecutionTime.forCron(cron)
+ val next = parsedCron.nextExecution(zonedNow)
logger.info("scheduling task ${it.taskName} at $next (now is
$zonedNow)")
it.nextScheduledExecutionSec = next.get().toEpochSecond()
}
@@ -139,7 +135,7 @@ suspend fun startOperationScheduler(httpClient: HttpClient)
{
}.map {
TaskSchedule(it.id.value, it.taskName, it.taskType,
it.resourceType, it.resourceId, it.taskParams)
}
- } // Execute those due tasks
+ } // Execute those due tasks and reset to null the next execution time.
dueTasks.forEach {
runTask(httpClient, it)
transaction {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.