gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: add missing rollbacks to fix som


From: gnunet
Subject: [taler-merchant] branch master updated: add missing rollbacks to fix some transactions
Date: Mon, 18 Jan 2021 11:23:33 +0100

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

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 41afb315 add missing rollbacks to fix some transactions
41afb315 is described below

commit 41afb315362492bcf0dc81776442e3cbd1202199
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Jan 18 11:23:31 2021 +0100

    add missing rollbacks to fix some transactions
---
 src/backend/taler-merchant-httpd_post-tips-ID-pickup.c    | 12 +++++++++---
 src/backend/taler-merchant-httpd_private-post-transfers.c |  2 ++
 src/backenddb/plugin_merchantdb_postgres.c                |  6 +++---
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c 
b/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
index f6a3ef4a..3de76848 100644
--- a/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
+++ b/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
@@ -830,6 +830,7 @@ RETRY:
       }
       if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
       {
+        TMH_db->rollback (TMH_db->cls);
         MHD_suspend_connection (connection);
         GNUNET_CONTAINER_DLL_insert (pc_head,
                                      pc_tail,
@@ -837,7 +838,6 @@ RETRY:
         pc->tt = GNUNET_SCHEDULER_add_delayed (EXCHANGE_TIMEOUT,
                                                &do_timeout,
                                                pc);
-        TMH_db->rollback (TMH_db->cls);
         return MHD_YES;
       }
     }
@@ -902,10 +902,16 @@ RETRY:
                            &exchange_url,
                            &pc->reserve_priv);
   if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
+  {
+    TMH_db->rollback (TMH_db->cls);
     goto RETRY;
+  }
   if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
+  {
+    TMH_db->rollback (TMH_db->cls);
     return reply_lookup_tip_failed (connection,
                                     qs);
+  }
   if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us)
   {
     TMH_db->rollback (TMH_db->cls);
@@ -919,7 +925,7 @@ RETRY:
                              &total_authorized,
                              &total_picked_up))
   {
-    GNUNET_break (0);
+    GNUNET_break_op (0);
     TMH_db->rollback (TMH_db->cls);
     return TALER_MHD_reply_with_error (connection,
                                        MHD_HTTP_INTERNAL_SERVER_ERROR,
@@ -931,7 +937,7 @@ RETRY:
       TALER_amount_cmp (&total_remaining,
                         &pc->total_requested))
   {
-    GNUNET_break (0);
+    GNUNET_break_op (0);
     TMH_db->rollback (TMH_db->cls);
     return TALER_MHD_reply_with_error (connection,
                                        MHD_HTTP_BAD_REQUEST,
diff --git a/src/backend/taler-merchant-httpd_private-post-transfers.c 
b/src/backend/taler-merchant-httpd_private-post-transfers.c
index 178c609c..dda8bf11 100644
--- a/src/backend/taler-merchant-httpd_private-post-transfers.c
+++ b/src/backend/taler-merchant-httpd_private-post-transfers.c
@@ -498,6 +498,8 @@ retry:
     }
     if (0 <= qs)
       break; /* success! */
+    /* soft failure, rollback and try again */
+    TMH_db->rollback (TMH_db->cls);
   }
   if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
   {
diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index 5954e3c6..8852bb92 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -1180,7 +1180,8 @@ postgres_lookup_order (void *cls,
     if (NULL != contract_terms)
       *contract_terms = NULL;
     if (NULL != claim_token)
-      *claim_token = (struct TALER_ClaimTokenP) { 0 };
+      *claim_token = (struct TALER_ClaimTokenP) { 0 }
+    ;
   }
   return qs;
 }
@@ -5246,9 +5247,8 @@ RETRY:
       return
         TALER_EC_GENERIC_DB_FETCH_FAILED;
     }
-    if (qs == 0)
+    if (0 == qs)
     {
-      GNUNET_break (0);
       postgres_rollback (pg);
       return TALER_EC_MERCHANT_PRIVATE_POST_TIP_AUTHORIZE_RESERVE_NOT_FOUND;
     }

-- 
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]