[mod_mariadb] Fix reconnect during db failover/restart
This commit is contained in:
parent
9b0cfefce7
commit
477086b3e2
|
@ -53,6 +53,8 @@ int mariadb_db_set_connection(MYSQL *mysql, enum enum_server_command command, co
|
|||
size_t length, my_bool skipp_check, void *opt_arg);
|
||||
my_bool mariadb_db_dsn_reconnect(MYSQL *mysql);
|
||||
|
||||
my_bool reconnect = 1;
|
||||
|
||||
#define DEFAULT_MARIADB_RETRIES 120
|
||||
|
||||
#ifndef MIN
|
||||
|
@ -474,10 +476,13 @@ switch_status_t mariadb_handle_connect(mariadb_handle_t *handle)
|
|||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Connecting %s\n", handle->dsn);
|
||||
mysql_init(&handle->con);
|
||||
|
||||
// Enable non-blocking operation
|
||||
// https://mariadb.com/kb/en/library/using-the-non-blocking-library/
|
||||
/* Enable non-blocking operation */
|
||||
/* https://mariadb.com/kb/en/library/using-the-non-blocking-library */
|
||||
mysql_options(&handle->con, MYSQL_OPT_NONBLOCK, 0);
|
||||
|
||||
/* Enable automatic reconnect with the mariadb_reconnect function, without this that function does not work */
|
||||
mysql_options(&handle->con, MYSQL_OPT_RECONNECT, &reconnect);
|
||||
|
||||
/* set timeouts to 300 microseconds */
|
||||
/*int default_timeout = 3;
|
||||
mysql_options(&handle->con, MYSQL_OPT_READ_TIMEOUT, &default_timeout);
|
||||
|
|
Loading…
Reference in New Issue