gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] branch master updated: fix /pay transactio


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: fix /pay transaction retry logic
Date: Thu, 31 Aug 2017 14:36:26 +0200

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 149d75d  fix /pay transaction retry logic
149d75d is described below

commit 149d75dbb5a6d6b4c6151705dcace26f58b643f4
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Aug 31 14:36:29 2017 +0200

    fix /pay transaction retry logic
---
 src/backend/taler-merchant-httpd_pay.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_pay.c 
b/src/backend/taler-merchant-httpd_pay.c
index aa4b41f..93e76d1 100644
--- a/src/backend/taler-merchant-httpd_pay.c
+++ b/src/backend/taler-merchant-httpd_pay.c
@@ -1437,7 +1437,11 @@ handler_pay_json (struct MHD_Connection *connection,
 
     for (unsigned int i=0;i<MAX_RETRIES;i++)
     {
-
+      if (GNUNET_OK != db->start (db->cls))
+      {
+        qs_st = GNUNET_DB_STATUS_HARD_ERROR;
+        break;
+      }
       qs_st = db->store_transaction (db->cls,
                                      &pc->h_contract_terms,
                                      &pc->mi->pubkey,
@@ -1450,13 +1454,9 @@ handler_pay_json (struct MHD_Connection *connection,
       /* Only retry if SOFT error occurred.  Exit in case of OK or HARD 
failure */
       if (GNUNET_DB_STATUS_SOFT_ERROR == qs_st)
       {
-        GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                    "Rolling back db transaction\n");
         db->rollback (db->cls);
-        break;
+        continue;
       }
-
-
       /* Only retry if SOFT error occurred.  Exit in case of OK or HARD 
failure */
       if (GNUNET_DB_STATUS_HARD_ERROR == qs_st)
       {
@@ -1466,22 +1466,22 @@ handler_pay_json (struct MHD_Connection *connection,
                                                   
TALER_EC_PAY_DB_STORE_TRANSACTION_ERROR,
                                                  "Merchant database error: 
hard error while storing transaction");
       }
-      continue;
+      break;
     }
 
     /**
      * Break if we couldn't modify one, and only one line; this
      * includes hard errors.
      */
-    if (1 != qs_st)
+    if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs_st)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "No DB errors occurred, but more than one line was 
modified!\n");
+                  "Unexpected query status %d while storing /pay 
transaction!\n",
+                  (int) qs_st);
       return TMH_RESPONSE_reply_internal_error (connection,
                                                
TALER_EC_PAY_DB_STORE_TRANSACTION_ERROR,
-                                               "Merchant database error: badly 
stored transaction");
+                                               "Merchant database error: 
failed to store transaction");
     }
-
   }
 
   MHD_suspend_connection (connection);

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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