summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-09-06 12:01:15 +0200
committerChristian Grothoff <christian@grothoff.org>2021-09-06 12:01:15 +0200
commited6ab2f91ababd1e840aec4feb187d40c4e87ab4 (patch)
tree2a38356af09d280dc01a3452ad5b7b3d2971cf96 /src/exchange
parent9086ed15c11db106179d54d125cbd3850eda0dc7 (diff)
downloadexchange-ed6ab2f91ababd1e840aec4feb187d40c4e87ab4.tar.gz
exchange-ed6ab2f91ababd1e840aec4feb187d40c4e87ab4.tar.bz2
exchange-ed6ab2f91ababd1e840aec4feb187d40c4e87ab4.zip
-minor fixes
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-transfer.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/exchange/taler-exchange-transfer.c b/src/exchange/taler-exchange-transfer.c
index 51987fbfa..c2ad59ae5 100644
--- a/src/exchange/taler-exchange-transfer.c
+++ b/src/exchange/taler-exchange-transfer.c
@@ -28,10 +28,10 @@
#include "taler_bank_service.h"
/**
- * What is the maximum batch size we use for credit history
+ * What is the default batch size we use for credit history
* requests with the bank. See `batch_size` below.
*/
-#define MAXIMUM_BATCH_SIZE 1024
+#define DEFAULT_BATCH_SIZE (4 * 1024)
/**
* How often will we retry a request (given certain
@@ -161,6 +161,11 @@ static struct Shard *shard;
static struct GNUNET_CURL_Context *ctx;
/**
+ * Randomized back-off we use on serialization errors.
+ */
+static struct GNUNET_TIME_Relative serialization_delay;
+
+/**
* Scheduler context for running the @e ctx.
*/
static struct GNUNET_CURL_RescheduleContext *rc;
@@ -189,11 +194,9 @@ static struct GNUNET_TIME_Relative transfer_idle_sleep_interval;
static struct GNUNET_TIME_Relative shard_delay;
/**
- * Modulus to apply to group shards. The shard size must ultimately be a
- * multiple of the batch size. Thus, if this is not a multiple of the
- * #MAXIMUM_BATCH_SIZE, the batch size will be set to the #shard_size.
+ * Size of the shards.
*/
-static unsigned int shard_size = MAXIMUM_BATCH_SIZE;
+static unsigned int shard_size = DEFAULT_BATCH_SIZE;
/**
* How many workers should we plan our scheduling with?
@@ -313,7 +316,10 @@ commit_or_warn (void)
qs = db_plugin->commit (db_plugin->cls);
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
+ {
+ serialization_delay = GNUNET_TIME_UNIT_ZERO;
return qs;
+ }
GNUNET_log ((GNUNET_DB_STATUS_SOFT_ERROR == qs)
? GNUNET_ERROR_TYPE_INFO
: GNUNET_ERROR_TYPE_ERROR,
@@ -765,16 +771,14 @@ select_shard (void *cls)
case GNUNET_DB_STATUS_SOFT_ERROR:
/* try again */
{
- static struct GNUNET_TIME_Relative delay;
-
- delay = GNUNET_TIME_randomized_backoff (delay,
- GNUNET_TIME_UNIT_SECONDS);
+ serialization_delay = GNUNET_TIME_randomized_backoff (serialization_delay,
+ GNUNET_TIME_UNIT_SECONDS);
GNUNET_assert (NULL == task);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Serialization failure, trying again in %s!\n",
- GNUNET_STRINGS_relative_time_to_string (delay,
+ GNUNET_STRINGS_relative_time_to_string (serialization_delay,
GNUNET_YES));
- task = GNUNET_SCHEDULER_add_delayed (delay,
+ task = GNUNET_SCHEDULER_add_delayed (serialization_delay,
&select_shard,
NULL);
}