add function

This commit is contained in:
lnk
2025-09-02 14:58:19 +08:00
parent 077c3f45a2
commit 0af8d02bb2
10 changed files with 951 additions and 42 deletions

View File

@@ -344,18 +344,32 @@ void Front::OnTimerThread()
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
std::cout << "OnTimerThread::run() is called ...... \n";
int counter = 0;
int hbCounter = 0; // 心跳计数
int backupCounter = 0; // 备份计数(分钟用)
send_heartbeat_to_queue("1");
while (!m_IsTimerCancel)
{
update_log_entries_countdown();
if (counter >= 30) {
//业务超时检查
check_device_busy_timeout();
// 每 30 秒发一次心跳
if (hbCounter >= 30) {
send_heartbeat_to_queue("1");
counter = 0;
hbCounter = 0;
}
counter++;
// 每 60 秒调用一次录波文件检查
if (backupCounter >= 60) {
check_and_backup_qvvr_files();
backupCounter = 0;
}
hbCounter++;
backupCounter++;
g_ontime_blocked_times = 0;
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
@@ -366,7 +380,6 @@ void Front::OnTimerThread()
std::cerr << "[OnTimerThread] Caught unknown exception" << std::endl;
}
// 设置重启标志
{
std::lock_guard<std::mutex> lock(m_threadCheckMutex);
m_needRestartTimerThread = true;