mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 01:16:35 +03:00
Fix initial session state load
This commit is contained in:
parent
c16fb0dae6
commit
09b9cd8193
|
@ -543,7 +543,7 @@ class TelegramBaseClient(abc.ABC):
|
|||
for entity_id, state in await self.session.get_update_states():
|
||||
if entity_id == 0:
|
||||
# TODO current session doesn't store self-user info but adding that is breaking on downstream session impls
|
||||
ss = SessionState(0, 0, False, state.pts, state.qts, state.date, state.seq, None)
|
||||
ss = SessionState(0, 0, False, state.pts, state.qts, int(state.date.timestamp()), state.seq, None)
|
||||
else:
|
||||
cs.append(ChannelState(entity_id, state.pts))
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user