Since SQLite3 does not automatically parse any timestamps, usually all
events were dropped because of an inconsistent comparison.
This patch will now convert the timestamp into float, so it can be
better compared to the timestamp which is stored as a REAL.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
# Save when we performed this last
self.reporter.last_cleanup_at = now
+ # Determine the timestamp as float
+ t = (now - retention_days).timestamp()
+
# Remove everything
self.db.execute(
- "DELETE FROM alerts WHERE timestamp <= ?",
- (now - retention_days,),
+ "DELETE FROM alerts WHERE timestamp <= ?", (t,),
)
# Release the lock