DO like we do in 1.36 and only update the db monitor_status table every 10 seconds instead of every second.

pull/4201/head
Isaac Connor 2025-01-01 12:05:43 -05:00
parent 72330a5234
commit 4b34efa1cd
2 changed files with 5 additions and 0 deletions

View File

@ -1855,10 +1855,14 @@ void Monitor::UpdateFPS() {
last_camera_bytes = new_camera_bytes;
last_fps_time = now;
FPSeconds db_elapsed = now - last_status_time;
if (db_elapsed > Seconds(10)) {
std::string sql = stringtf(
"UPDATE LOW_PRIORITY Monitor_Status SET Status='Connected', CaptureFPS = %.2lf, CaptureBandwidth=%u, AnalysisFPS = %.2lf, UpdatedOn=NOW() WHERE MonitorId=%u",
new_capture_fps, new_capture_bandwidth, new_analysis_fps, id);
dbQueue.push(std::move(sql));
last_status_time = now;
}
} // now != last_fps_time
} // void Monitor::UpdateFPS()

View File

@ -569,6 +569,7 @@ class Monitor : public std::enable_shared_from_this<Monitor> {
State state;
SystemTimePoint start_time;
SystemTimePoint last_fps_time;
SystemTimePoint last_status_time;
SystemTimePoint last_analysis_fps_time;
SystemTimePoint auto_resume_time;
unsigned int last_motion_score;