If event db insert fails, try again until it succeeds.

This commit is contained in:
Isaac Connor 2020-11-04 11:59:08 -05:00
parent af399bb174
commit 09fe354a22
1 changed files with 2 additions and 4 deletions

View File

@ -106,12 +106,10 @@ Event::Event(
storage->SchemeString().c_str()
);
db_mutex.lock();
if ( mysql_query(&dbconn, sql) ) {
while ( mysql_query(&dbconn, sql) ) {
db_mutex.unlock();
Error("Can't insert event: %s. sql was (%s)", mysql_error(&dbconn), sql);
return;
} else {
Debug(2, "Created new event with %s", sql);
db_mutex.lock();
}
id = mysql_insert_id(&dbconn);