gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated (a9294852 -> ba753728)


From: gnunet
Subject: [libeufin] branch master updated (a9294852 -> ba753728)
Date: Wed, 05 Apr 2023 12:47:43 +0200

This is an automated email from the git hooks/post-receive script.

ms pushed a change to branch master
in repository libeufin.

    from a9294852 deleting cashouts with failed TAN
     new fffccf0a reverting last change
     new ba753728 indentation

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 nexus/src/main/kotlin/tech/libeufin/nexus/Scheduling.kt    | 14 +++++---------
 .../src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt    |  8 +++-----
 2 files changed, 8 insertions(+), 14 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 {
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt
index 6b6c2be2..0e2f4600 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt
@@ -551,10 +551,11 @@ fun circuitApi(circuitRoute: Route) {
                         message = op.tan
                     )
                 } catch (e: Exception) {
-                    throw internalServerError(
+                    logger.error(
                         "Sending the e-mail TAN failed for ${customer.email}." 
+
                                 "  The command threw this exception: 
${e.message}"
                     )
+                    false
                 }
                 if (!isSuccessful)
                     throw internalServerError(
@@ -582,12 +583,9 @@ fun circuitApi(circuitRoute: Route) {
                                 " The command threw this exception: 
${e.message}"
                     )
                 }
-                if (!isSuccessful) {
-                    logger.error("Cashout ${op.uuid} failed, deleting it.")
-                    transaction { op.delete() }
+                if (!isSuccessful)
                     throw internalServerError(
                         "SMS TAN command failed for ${customer.phone}.")
-                }
             }
             SupportedTanChannels.FILE.name -> {
                 try {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]