Fix initial session state load

This commit is contained in:
Lonami Exo
2022-05-16 19:01:05 +02:00
parent c16fb0dae6
commit 09b9cd8193
2 changed files with 8 additions and 2 deletions

View File

@@ -219,7 +219,13 @@ class SQLiteSession(MemorySession):
c = self._cursor()
try:
rows = c.execute('select id, pts, qts, date, seq from update_state').fetchall()
return ((row[0], types.updates.State(*row[1:], unread_count=0)) for row in rows)
return ((row[0], types.updates.State(
pts=row[1],
qts=row[2],
date=datetime.datetime.fromtimestamp(row[3], tz=datetime.timezone.utc),
seq=row[4],
unread_count=0)
) for row in rows)
finally:
c.close()