From e0862f9e448fdda5a91a645f2f97e7e81db69c76 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Tue, 27 Oct 2020 22:27:10 -0700 Subject: [PATCH] Order by id instead of time because timestamps may be nonmonotonic. Probably a result of moderator actions, I found that items with a lower id could have a higher timestamp, enough to offset it by 2,000 ids. --- hnarchive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hnarchive.py b/hnarchive.py index 90ea9cb..da41851 100644 --- a/hnarchive.py +++ b/hnarchive.py @@ -220,7 +220,7 @@ def select_item(id): return item def select_latest_id(): - cur = sql.execute('SELECT id FROM items ORDER BY time DESC, id ASC LIMIT 1') + cur = sql.execute('SELECT id FROM items ORDER BY id DESC LIMIT 1') row = cur.fetchone() if row is None: return None