Wait forever until reconnect, the fallthrough case had us retrying the sql on a closed connection which may have led to a crash.

pull/3850/head
Isaac Connor 2024-03-04 09:32:15 -05:00
parent 89de8b7765
commit b9da90522b
1 changed files with 2 additions and 1 deletions

View File

@ -199,10 +199,11 @@ int zmDbDo(const std::string &query) {
while ((rc = mysql_query(&dbconn, query.c_str())) and !zm_terminate) {
if (mysql_ping(&dbconn)) {
// Was a connection error
if (!zmDbReconnect()) {
while (!zmDbReconnect() and !zm_terminate) {
// If we failed. Sleeping 1 sec may be way too much.
sleep(1);
}
if (zm_terminate) return 0;
} else {
// Not a connection error
Error("Can't run query %s: %s", query.c_str(), mysql_error(&dbconn));