From 911628fe61e89935a69dcf6cec59c6f98d181163 Mon Sep 17 00:00:00 2001 From: Lorenzo Venerandi Date: Tue, 3 Mar 2026 19:45:36 +0100 Subject: [PATCH] fix: correct logic for flagging stale IPs for reevaluation based on last_seen timestamp --- src/database.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/database.py b/src/database.py index a44ad3e..ab026de 100644 --- a/src/database.py +++ b/src/database.py @@ -815,7 +815,7 @@ class DatabaseManager: def flag_stale_ips_for_reevaluation(self) -> int: """ Flag IPs for reevaluation where: - - last_seen is older than the configured retention period + - last_seen is newer than the configured retention period - last_analysis is more than 5 days ago Returns: @@ -833,7 +833,7 @@ class DatabaseManager: count = ( session.query(IpStats) .filter( - IpStats.last_seen <= last_seen_cutoff, + IpStats.last_seen >= last_seen_cutoff, IpStats.last_analysis <= last_analysis_cutoff, IpStats.need_reevaluation == False, IpStats.manual_category == False,