use different sleep when idle vs. when conflicting in wirewatch

This commit is contained in:
Christian Grothoff 2023-01-06 13:34:01 +01:00
parent 463b3af4ea
commit 7ee7790ac4
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -153,6 +153,11 @@ static struct TALER_EXCHANGEDB_Plugin *db_plugin;
*/
static struct GNUNET_TIME_Relative wirewatch_idle_sleep_interval;
/**
* How long do we sleep on serialization conflicts?
*/
static struct GNUNET_TIME_Relative wirewatch_conflict_sleep_interval;
/**
* 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
@ -1200,7 +1205,9 @@ lock_shard (void *cls)
{
struct GNUNET_TIME_Relative rdelay;
rdelay = GNUNET_TIME_randomize (wirewatch_idle_sleep_interval);
wirewatch_conflict_sleep_interval
= GNUNET_TIME_STD_BACKOFF (wirewatch_conflict_sleep_interval);
rdelay = GNUNET_TIME_randomize (wirewatch_conflict_sleep_interval);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Serialization error tying to obtain shard %s, will try again in %s!\n",
job_name,
@ -1227,6 +1234,7 @@ lock_shard (void *cls)
return;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
/* continued below */
wirewatch_conflict_sleep_interval = GNUNET_TIME_UNIT_ZERO;
break;
}
shard_end_time = GNUNET_TIME_relative_to_absolute (delay);