From eedb0b97cf17ca2cbf916753d2ed2155fe3cff02 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 19 May 2024 10:26:48 -0400 Subject: [PATCH] Delete Monitor_Status records that havn't been updated in over a minute. --- scripts/zmstats.pl.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/zmstats.pl.in b/scripts/zmstats.pl.in index 93f6a9331..68e8de6e4 100644 --- a/scripts/zmstats.pl.in +++ b/scripts/zmstats.pl.in @@ -79,8 +79,8 @@ while (!$zm_terminate) { Debug("Deleted $rows Server Stats table entries by time"); } - # Clear out statuses for Monitors that have been set to None but for some reason didn't update the db - zmDbDo('DELETE FROM Monitor_Status WHERE MonitorId IN (SELECT Id FROM Monitors WHERE Capturing=\'None\')'); + # Clear out statuses for Monitors that aren't updating themselves. + zmDbDo('DELETE FROM Monitor_Status WHERE UpdatedOn < timestamp(DATE_SUB(NOW(), INTERVAL 1 MINUTE))?'); zmDbDo('DELETE FROM Events_Hour WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 hour)'); zmDbDo('DELETE FROM Events_Day WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 day)');