aboutsummaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd.c
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2023-03-11 11:51:02 +0100
committerÖzgür Kesim <oec-taler@kesim.org>2023-03-11 11:51:02 +0100
commit777a4c07cfa0eadfa37caaa6e100275bb21affaa (patch)
treead3c2f79102f5a825f9b89b2ba7ac73717bedb5a /src/exchange/taler-exchange-httpd.c
parente3d5672cbd8fdcbc7df9c52f90b7d639ad1675d9 (diff)
parentce71db2c0b1a8dcc3021d2ba8549c31501c098b2 (diff)
Merge branch 'master' into age-withdraw
Diffstat (limited to 'src/exchange/taler-exchange-httpd.c')
-rw-r--r--src/exchange/taler-exchange-httpd.c20
1 files changed, 17 insertions, 3 deletions
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
@@ -81,6 +81,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?
*/
#define WARN_LATENCY GNUNET_TIME_relative_multiply ( \
@@ -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;