gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: use precise time for shards


From: gnunet
Subject: [taler-exchange] branch master updated: use precise time for shards
Date: Tue, 24 May 2022 12:00:25 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new d77354b1 use precise time for shards
d77354b1 is described below

commit d77354b11ad73834aa75d4e61874b7bb901c1aa3
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue May 24 12:00:20 2022 +0200

    use precise time for shards
---
 src/exchange/taler-exchange-wirewatch.c     | 12 ++++++++----
 src/exchangedb/plugin_exchangedb_postgres.c | 20 +++++++++-----------
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/src/exchange/taler-exchange-wirewatch.c 
b/src/exchange/taler-exchange-wirewatch.c
index a1435627..7a17239d 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 5924c9bf..d0d6ca18 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,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]