retry on failure
This commit is contained in:
parent
74facbead4
commit
9d5549d6ba
@ -1 +1 @@
|
||||
Subproject commit 02132ededc12a0a1cfd81f0ca76c384304e15259
|
||||
Subproject commit e2c325ca89b92aed98a30b23fd653b1adb9af683
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user