Update CaptureFPS SQL to just do an update and don't use static sql. TThis may fix a signal 6 crash that we have been seeing

pull/3195/head
Isaac Connor 2021-03-17 10:06:45 -04:00
parent 14ef8336b9
commit 74616d1061
1 changed files with 4 additions and 10 deletions

View File

@ -1734,16 +1734,10 @@ void Monitor::UpdateCaptureFPS() {
last_fps_time = now_double;
last_capture_image_count = image_count;
static char sql[ZM_SQL_SML_BUFSIZ];
// The reason we update the Status as well is because if mysql restarts, the Monitor_Status table is lost,
// and nothing else will update the status until zmc restarts. Since we are successfully capturing we can
// assume that we are connected
snprintf(sql, sizeof(sql),
"INSERT INTO Monitor_Status (MonitorId,CaptureFPS,CaptureBandwidth,Status) "
"VALUES (%d, %.2lf, %u, 'Connected') ON DUPLICATE KEY UPDATE "
"CaptureFPS = %.2lf, CaptureBandwidth=%u, Status='Connected'",
id, new_capture_fps, new_capture_bandwidth, new_capture_fps, new_capture_bandwidth);
dbQueue.push(sql);
std::string sql = stringtf(
"UPDATE Monitor_Status SET CaptureFPS = %.2lf, CaptureBandwidth=%u WHERE MonitorId=%u",
new_capture_fps, new_capture_bandwidth, id);
dbQueue.push(sql.c_str());
} // now != last_fps_time
} // end if report fps
} // void Monitor::UpdateCaptureFPS()