mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 04:52:30 +00:00
Revert async sessions from 3dd8b7c
(breaks sync properties)
Such as ChatGetter.input_chat and SenderGetter.input_sender which rely on the fact that access to the session file will be synchronous.
This commit is contained in:
@@ -137,7 +137,7 @@ class UpdateMethods(UserMethods):
|
||||
|
||||
This can also be used to forcibly fetch new updates if there are any.
|
||||
"""
|
||||
state = await self.session.get_update_state(0)
|
||||
state = self.session.get_update_state(0)
|
||||
if not state or not state.pts:
|
||||
state = await self(functions.updates.GetStateRequest())
|
||||
|
||||
@@ -172,7 +172,7 @@ class UpdateMethods(UserMethods):
|
||||
state.pts = d.pts
|
||||
break
|
||||
finally:
|
||||
await self.session.set_update_state(0, state)
|
||||
self.session.set_update_state(0, state)
|
||||
self.session.catching_up = False
|
||||
|
||||
# endregion
|
||||
@@ -180,7 +180,7 @@ class UpdateMethods(UserMethods):
|
||||
# region Private methods
|
||||
|
||||
async def _handle_update(self, update):
|
||||
await self.session.process_entities(update)
|
||||
self.session.process_entities(update)
|
||||
if isinstance(update, (types.Updates, types.UpdatesCombined)):
|
||||
entities = {utils.get_peer_id(x): x for x in
|
||||
itertools.chain(update.users, update.chats)}
|
||||
@@ -236,7 +236,7 @@ class UpdateMethods(UserMethods):
|
||||
# inserted because this is a rather expensive operation
|
||||
# (default's sqlite3 takes ~0.1s to commit changes). Do
|
||||
# it every minute instead. No-op if there's nothing new.
|
||||
await self.session.save()
|
||||
self.session.save()
|
||||
|
||||
# We need to send some content-related request at least hourly
|
||||
# for Telegram to keep delivering updates, otherwise they will
|
||||
|
Reference in New Issue
Block a user