gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: retry on failure


From: gnunet
Subject: [taler-exchange] branch master updated: retry on failure
Date: Thu, 09 Mar 2023 19:48:32 +0100

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 9d5549d6 retry on failure
9d5549d6 is described below

commit 9d5549d6ba06d34597f00da21d19c6375a70f8aa
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Mar 9 19:48:29 2023 +0100

    retry on failure
---
 contrib/gana                        |  2 +-
 src/exchange/taler-exchange-httpd.c | 20 +++++++++++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/contrib/gana b/contrib/gana
index 02132ede..e2c325ca 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 02132ededc12a0a1cfd81f0ca76c384304e15259
+Subproject commit e2c325ca89b92aed98a30b23fd653b1adb9af683
diff --git a/src/exchange/taler-exchange-httpd.c 
b/src/exchange/taler-exchange-httpd.c
index c88ddd7c..d247d981 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -80,6 +80,11 @@
  */
 #define UNIX_BACKLOG 50
 
+/**
+ * How often will we try to connect to the database before giving up?
+ */
+#define MAX_DB_RETRIES 5
+
 /**
  * Above what request latency do we start to log?
  */
@@ -1965,11 +1970,20 @@ exchange_serve_process_config (void)
     GNUNET_free (attr_enc_key_str);
   }
 
-  if (NULL ==
-      (TEH_plugin = TALER_EXCHANGEDB_plugin_load (TEH_cfg)))
+  for (unsigned int i = 0; i<MAX_DB_RETRIES; i++)
+  {
+    TEH_plugin = TALER_EXCHANGEDB_plugin_load (TEH_cfg);
+    if (NULL != TEH_plugin)
+      break;
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Failed to connect to DB, will try again %u times\n",
+                MAX_DB_RETRIES - i);
+    sleep (1);
+  }
+  if (NULL == TEH_plugin)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Failed to initialize DB subsystem\n");
+                "Failed to initialize DB subsystem. Giving up.\n");
     return GNUNET_SYSERR;
   }
   return GNUNET_OK;

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