-fix looping wirewatch (hopefully)

This commit is contained in:
Christian Grothoff 2022-10-26 23:06:23 +02:00
parent 889454aee5
commit 38a078d543
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -827,6 +827,8 @@ lock_shard (void *cls)
struct WireAccount *wa = cls; struct WireAccount *wa = cls;
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
struct GNUNET_TIME_Relative delay; struct GNUNET_TIME_Relative delay;
uint64_t last_shard_start = wa->shard_start;
uint64_t last_shard_end = wa->shard_end;
task = NULL; task = NULL;
if (GNUNET_SYSERR == if (GNUNET_SYSERR ==
@ -904,6 +906,7 @@ lock_shard (void *cls)
GNUNET_YES)); GNUNET_YES));
wa->delayed_until = GNUNET_TIME_relative_to_absolute ( wa->delayed_until = GNUNET_TIME_relative_to_absolute (
wirewatch_idle_sleep_interval); wirewatch_idle_sleep_interval);
wa->shard_open = false;
GNUNET_assert (NULL == task); GNUNET_assert (NULL == task);
schedule_transfers (wa->next); schedule_transfers (wa->next);
return; return;
@ -912,7 +915,6 @@ lock_shard (void *cls)
break; break;
} }
wa->shard_end_time = GNUNET_TIME_relative_to_absolute (delay); wa->shard_end_time = GNUNET_TIME_relative_to_absolute (delay);
wa->shard_open = true;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Starting with shard %s at (%llu,%llu] locked for %s\n", "Starting with shard %s at (%llu,%llu] locked for %s\n",
wa->job_name, wa->job_name,
@ -923,7 +925,13 @@ lock_shard (void *cls)
wa->delay = true; /* default is to delay, unless wa->delay = true; /* default is to delay, unless
we find out that we're really busy */ we find out that we're really busy */
wa->batch_start = wa->shard_start; wa->batch_start = wa->shard_start;
if ( (wa->shard_open) &&
(wa->shard_start == last_shard_start) &&
(wa->shard_end == last_shard_end) )
GNUNET_break (wa->latest_row_off >= wa->batch_start); /* resume where we left things */
else
wa->latest_row_off = wa->batch_start; wa->latest_row_off = wa->batch_start;
wa->shard_open = true;
task = GNUNET_SCHEDULER_add_now (&continue_with_shard, task = GNUNET_SCHEDULER_add_now (&continue_with_shard,
wa); wa);
} }