aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-03-06 09:46:09 +0100
committerChristian Grothoff <christian@grothoff.org>2024-03-06 09:46:33 +0100
commit7d40a312835d2ce3ab93ef10189c70123421b222 (patch)
tree19e094a793e2432f7f906b873a65a12c3828a31c /src
parentd76c47abb9eadad9b6a7e283f316d851cda5d2fb (diff)
-more logical DB notify for aggregator
Diffstat (limited to 'src')
-rw-r--r--src/exchange/taler-exchange-aggregator.c20
-rw-r--r--src/exchangedb/pg_aggregate.c15
2 files changed, 20 insertions, 15 deletions
diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c
index fa7b02b08..691d65ae3 100644
--- a/src/exchange/taler-exchange-aggregator.c
+++ b/src/exchange/taler-exchange-aggregator.c
@@ -28,6 +28,7 @@
#include "taler_json_lib.h"
#include "taler_kyclogic_lib.h"
#include "taler_bank_service.h"
+#include "taler_dbevents.h"
/**
@@ -824,15 +825,30 @@ do_aggregate (struct AggregationUnit *au)
{
case GNUNET_DB_STATUS_SOFT_ERROR:
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Serialization issue during aggregation; trying again later!\n");
+ "Serialization issue during aggregation; trying again later!\n")
+ ;
return GNUNET_NO;
case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0);
global_ret = EXIT_FAILURE;
return GNUNET_SYSERR;
default:
- return GNUNET_OK;
+ break;
+ }
+ {
+ struct TALER_CoinDepositEventP rep = {
+ .header.size = htons (sizeof (rep)),
+ .header.type = htons (TALER_DBEVENT_EXCHANGE_DEPOSIT_STATUS_CHANGED),
+ .merchant_pub = au->merchant_pub
+ };
+
+ db_plugin->event_notify (db_plugin->cls,
+ &rep.header,
+ NULL,
+ 0);
}
+ return GNUNET_OK;
+
}
diff --git a/src/exchangedb/pg_aggregate.c b/src/exchangedb/pg_aggregate.c
index 16805d757..ba03e4a9c 100644
--- a/src/exchangedb/pg_aggregate.c
+++ b/src/exchangedb/pg_aggregate.c
@@ -122,7 +122,8 @@ TEH_PG_aggregate (
" SELECT batch_deposit_serial_id,$4"
" FROM bdep)"
"SELECT" /* calculate totals (deposits, refunds and fees) */
- " CAST(COALESCE(SUM((cdep.amount).val),0) AS INT8) AS sum_deposit_value" /* cast needed, otherwise we get NUMBER */
+ " CAST(COALESCE(SUM((cdep.amount).val),0) AS INT8) AS sum_deposit_value"
+ /* cast needed, otherwise we get NUMBER */
" ,COALESCE(SUM((cdep.amount).frac),0) AS sum_deposit_fraction" /* SUM over INT returns INT8 */
" ,CAST(COALESCE(SUM((ref.refund).val),0) AS INT8) AS sum_refund_value"
" ,COALESCE(SUM((ref.refund).frac),0) AS sum_refund_fraction"
@@ -174,18 +175,6 @@ TEH_PG_aggregate (
total));
return qs;
}
- {
- struct TALER_CoinDepositEventP rep = {
- .header.size = htons (sizeof (rep)),
- .header.type = htons (TALER_DBEVENT_EXCHANGE_DEPOSIT_STATUS_CHANGED),
- .merchant_pub = *merchant_pub
- };
-
- TEH_PG_event_notify (pg,
- &rep.header,
- NULL,
- 0);
- }
GNUNET_assert (GNUNET_OK ==
TALER_amount_set_zero (pg->currency,
&sum_deposit));