log: cutoff at the max id past the cutoff_date

Previously we were using the min, which is always going to be equivalant
to the min id in the table.
This commit is contained in:
Jimmy Zelinskie 2016-05-10 20:13:10 -07:00
parent f0bf138448
commit 972e4be811

View file

@ -162,7 +162,7 @@ def get_stale_logs_cutoff_id(cutoff_date):
""" Gets the most recent ID created before the cutoff_date. """
try:
return (LogEntry
.select(fn.Min(LogEntry.id))
.select(fn.Max(LogEntry.id))
.where(LogEntry.datetime <= cutoff_date)
.tuples())[0][0]
except IndexError: