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.
This commit is contained in:
parent
eff67f845d
commit
e0862f9e44
1 changed files with 1 additions and 1 deletions
|
@ -220,7 +220,7 @@ def select_item(id):
|
||||||
return item
|
return item
|
||||||
|
|
||||||
def select_latest_id():
|
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()
|
row = cur.fetchone()
|
||||||
if row is None:
|
if row is None:
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in a new issue