summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-06-22 13:15:50 +0200
committerChristian Grothoff <christian@grothoff.org>2021-06-22 13:15:50 +0200
commit0caf3ac2b7716b55da43b492d0a24e33694724c5 (patch)
treeafc09b24e7c8eb62639292e24302d10a5139bba4 /src/exchange
parentc9a928fe357a9f2c9e9b679ea18f3b394b492031 (diff)
downloadexchange-0caf3ac2b7716b55da43b492d0a24e33694724c5.tar.gz
exchange-0caf3ac2b7716b55da43b492d0a24e33694724c5.tar.bz2
exchange-0caf3ac2b7716b55da43b492d0a24e33694724c5.zip
-fix up wirewatch logic
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-wirewatch.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/exchange/taler-exchange-wirewatch.c b/src/exchange/taler-exchange-wirewatch.c
index 5d35eba57..03f6e9e87 100644
--- a/src/exchange/taler-exchange-wirewatch.c
+++ b/src/exchange/taler-exchange-wirewatch.c
@@ -116,7 +116,7 @@ struct WireAccount
/**
* How much do we incremnt @e batch_size on success?
*/
- unsigned int batch_increment;
+ unsigned int batch_thresh;
/**
* How many transactions did we see in the current batch?
@@ -375,8 +375,8 @@ handle_soft_error (struct WireAccount *wa)
wa->session);
if (1 < wa->batch_size)
{
+ wa->batch_thresh = wa->batch_size;
wa->batch_size /= 2;
- wa->batch_increment = 0;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Reduced batch size to %llu due to serialization issue\n",
(unsigned long long) wa->batch_size);
@@ -451,9 +451,13 @@ do_commit (struct WireAccount *wa)
wa->session = NULL; /* should not be needed */
if (wa->batch_size < MAXIMUM_BATCH_SIZE)
{
- wa->batch_increment++;
+ int delta;
+
+ delta = ((int) wa->batch_thresh - (int) wa->batch_size) / 4;
+ if (delta < 0)
+ delta = -delta;
wa->batch_size = GNUNET_MIN (MAXIMUM_BATCH_SIZE,
- wa->batch_size + wa->batch_increment);
+ wa->batch_size + delta + 1);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Increasing batch size to %llu\n",
(unsigned long long) wa->batch_size);
@@ -669,9 +673,9 @@ find_transfers (void *cls)
}
}
if (GNUNET_OK !=
- db_plugin->start (db_plugin->cls,
- session,
- "wirewatch check for incoming wire transfers"))
+ db_plugin->start_read_committed (db_plugin->cls,
+ session,
+ "wirewatch check for incoming wire transfers"))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start database transaction!\n");
@@ -679,6 +683,7 @@ find_transfers (void *cls)
GNUNET_SCHEDULER_shutdown ();
return;
}
+
limit = GNUNET_MIN (wa_pos->batch_size,
wa_pos->shard_end - wa_pos->batch_start);
GNUNET_assert (NULL == wa_pos->hh);