diff --git a/src/exchange/taler-exchange-wirewatch.c b/src/exchange/taler-exchange-wirewatch.c index a14356273..7a17239d9 100644 --- a/src/exchange/taler-exchange-wirewatch.c +++ b/src/exchange/taler-exchange-wirewatch.c @@ -417,7 +417,7 @@ schedule_transfers (struct WireAccount *wa) wa = wa_head; GNUNET_assert (NULL != wa); } - if (shard_done) + if (wa->shard_open) GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Will retry my shard (%llu,%llu] of %s in %s\n", (unsigned long long) wa->shard_start, @@ -527,14 +527,14 @@ check_shard_done (struct WireAccount *wa) break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: /* normal case */ - wa->shard_delay = GNUNET_TIME_absolute_get_duration (wa->shard_start_time); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Completed shard %s (%llu,%llu] after %s\n", wa->job_name, (unsigned long long) wa->shard_start, (unsigned long long) wa->shard_end, - GNUNET_STRINGS_relative_time_to_string (wa->shard_delay, - GNUNET_YES)); + GNUNET_STRINGS_relative_time_to_string ( + GNUNET_TIME_absolute_get_duration (wa->shard_start_time), + GNUNET_YES)); break; } return true; @@ -583,6 +583,7 @@ do_commit (struct WireAccount *wa) } if (shard_done) { + wa->shard_delay = GNUNET_TIME_absolute_get_duration (wa->shard_start_time); wa->shard_open = false; account_completed (wa); } @@ -829,6 +830,9 @@ lock_shard (void *cls) wa); return; } + if (wa->shard_open) + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Shard not completed in time, will try to re-acquire\n"); /* How long we lock a shard depends on the number of workers expected, and how long we usually took to process a shard. */ diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 5924c9bfe..d0d6ca18b 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -12946,17 +12946,16 @@ postgres_begin_shard (void *cls, case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: { enum GNUNET_DB_QueryStatus qs; - struct GNUNET_TIME_Timestamp now; + struct GNUNET_TIME_Absolute now; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_string (job_name), - GNUNET_PQ_query_param_timestamp (&now), + GNUNET_PQ_query_param_absolute_time (&now), GNUNET_PQ_query_param_uint64 (start_row), GNUNET_PQ_query_param_uint64 (end_row), GNUNET_PQ_query_param_end }; - now = GNUNET_TIME_absolute_to_timestamp ( - GNUNET_TIME_relative_to_absolute (delay)); + now = GNUNET_TIME_relative_to_absolute (delay); qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, "reclaim_shard", params); @@ -13021,17 +13020,16 @@ postgres_begin_shard (void *cls, /* Claim fresh shard */ { enum GNUNET_DB_QueryStatus qs; - struct GNUNET_TIME_Timestamp now; + struct GNUNET_TIME_Absolute now; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_string (job_name), - GNUNET_PQ_query_param_timestamp (&now), + GNUNET_PQ_query_param_absolute_time (&now), GNUNET_PQ_query_param_uint64 (start_row), GNUNET_PQ_query_param_uint64 (end_row), GNUNET_PQ_query_param_end }; - now = GNUNET_TIME_absolute_to_timestamp ( - GNUNET_TIME_relative_to_absolute (delay)); + now = GNUNET_TIME_relative_to_absolute (delay); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Trying to claim shard (%llu-%llu]\n", (unsigned long long) *start_row, @@ -13222,10 +13220,10 @@ postgres_begin_revolving_shard (void *cls, { /* Claim fresh shard */ enum GNUNET_DB_QueryStatus qs; - struct GNUNET_TIME_Timestamp now; + struct GNUNET_TIME_Absolute now; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_string (job_name), - GNUNET_PQ_query_param_timestamp (&now), + GNUNET_PQ_query_param_absolute_time (&now), GNUNET_PQ_query_param_uint32 (start_row), GNUNET_PQ_query_param_uint32 (end_row), GNUNET_PQ_query_param_end @@ -13233,7 +13231,7 @@ postgres_begin_revolving_shard (void *cls, *end_row = GNUNET_MIN (shard_limit, *start_row + shard_size - 1); - now = GNUNET_TIME_timestamp_get (); + now = GNUNET_TIME_absolute_get (); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Trying to claim shard %llu-%llu\n", (unsigned long long) *start_row,