fix: update stale IP reevaluation logic to flag IPs last seen over 30 days ago
This commit is contained in:
@@ -815,7 +815,7 @@ class DatabaseManager:
|
|||||||
def flag_stale_ips_for_reevaluation(self) -> int:
|
def flag_stale_ips_for_reevaluation(self) -> int:
|
||||||
"""
|
"""
|
||||||
Flag IPs for reevaluation where:
|
Flag IPs for reevaluation where:
|
||||||
- last_seen is between 5 and 30 days ago
|
- last_seen is more than 30 days ago
|
||||||
- last_analysis is more than 5 days ago
|
- last_analysis is more than 5 days ago
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -824,15 +824,13 @@ class DatabaseManager:
|
|||||||
session = self.session
|
session = self.session
|
||||||
try:
|
try:
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
last_seen_lower = now - timedelta(days=30)
|
last_seen_cutoff = now - timedelta(days=30)
|
||||||
last_seen_upper = now - timedelta(days=5)
|
|
||||||
last_analysis_cutoff = now - timedelta(days=5)
|
last_analysis_cutoff = now - timedelta(days=5)
|
||||||
|
|
||||||
count = (
|
count = (
|
||||||
session.query(IpStats)
|
session.query(IpStats)
|
||||||
.filter(
|
.filter(
|
||||||
IpStats.last_seen >= last_seen_lower,
|
IpStats.last_seen <= last_seen_cutoff,
|
||||||
IpStats.last_seen <= last_seen_upper,
|
|
||||||
IpStats.last_analysis <= last_analysis_cutoff,
|
IpStats.last_analysis <= last_analysis_cutoff,
|
||||||
IpStats.need_reevaluation == False,
|
IpStats.need_reevaluation == False,
|
||||||
IpStats.manual_category == False,
|
IpStats.manual_category == False,
|
||||||
|
|||||||
Reference in New Issue
Block a user