diff options
author | MS <ms@taler.net> | 2023-07-28 16:57:34 +0200 |
---|---|---|
committer | MS <ms@taler.net> | 2023-07-28 16:57:34 +0200 |
commit | d72290e523da8aa1dda3f072e3ecf232700f4cfe (patch) | |
tree | d8e6ecf92b8269f005bed72e5bf8aca00580ab38 /sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | |
parent | d2fe54bfd303a5f3d2a2d2a3e0920a3fd1c2f376 (diff) | |
download | libeufin-d72290e523da8aa1dda3f072e3ecf232700f4cfe.tar.gz libeufin-d72290e523da8aa1dda3f072e3ecf232700f4cfe.tar.bz2 libeufin-d72290e523da8aa1dda3f072e3ecf232700f4cfe.zip |
Testing the EBICS time-framed history request.
Diffstat (limited to 'sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt')
-rw-r--r-- | sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt index bfd521cc..0dc7b742 100644 --- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt +++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt @@ -518,6 +518,7 @@ private suspend fun getWithdrawal(call: ApplicationCall) { private suspend fun confirmWithdrawal(call: ApplicationCall) { val withdrawalId = call.expectUriComponent("withdrawal_id") + logger.debug("Maybe confirming withdrawal: $withdrawalId") transaction { val wo = getWithdrawalOperation(withdrawalId) if (wo.aborted) throw SandboxError( @@ -541,6 +542,7 @@ private suspend fun confirmWithdrawal(call: ApplicationCall) { "Cannot withdraw without an exchange." ) ) + logger.debug("Withdrawal ${wo.wopid} confirmed? ${wo.confirmationDone}") if (!wo.confirmationDone) { wireTransfer( debitAccount = wo.walletBankAccount, @@ -1557,15 +1559,18 @@ val sandboxApp: Application.() -> Unit = { var ret: List<XLibeufinBankTransaction> = transaction { extractTxHistory(historyParams) } + logger.debug("Is payment data empty? ${ret.isEmpty()}") // Data was found already, UNLISTEN and respond. if (listenHandle != null && ret.isNotEmpty()) { + logger.debug("No need to wait DB events, payment data found.") listenHandle.postgresUnlisten() call.respond(object {val transactions = ret}) return@get } // No data was found, sleep until the timeout or getting woken up. // Third condition only silences the compiler. - if (listenHandle != null && ret.isEmpty() && longPollMs != null) { + if (listenHandle != null && longPollMs != null) { + logger.debug("Waiting DB event for new payment data.") val notificationArrived = listenHandle.waitOnIODispatchers(longPollMs) // Only if the awaited event fired, query again the DB. if (notificationArrived) |