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:
Lonami Exo
2018-10-12 22:00:02 +02:00
parent e677a6bb05
commit cf6686ff42
6 changed files with 29 additions and 21 deletions

View File

@@ -48,7 +48,7 @@ class UserMethods(TelegramBaseClient):
exceptions.append(e)
results.append(None)
continue
await self.session.process_entities(result)
self.session.process_entities(result)
exceptions.append(None)
results.append(result)
request_index += 1
@@ -58,7 +58,7 @@ class UserMethods(TelegramBaseClient):
return results
else:
result = await future
await self.session.process_entities(result)
self.session.process_entities(result)
return result
except (errors.ServerError, errors.RpcCallFailError) as e:
__log__.warning('Telegram is having internal issues %s: %s',
@@ -288,7 +288,7 @@ class UserMethods(TelegramBaseClient):
try:
# First try to get the entity from cache, otherwise figure it out
return await self.session.get_input_entity(peer)
return self.session.get_input_entity(peer)
except ValueError:
pass
@@ -393,7 +393,7 @@ class UserMethods(TelegramBaseClient):
try:
# Nobody with this username, maybe it's an exact name/title
return await self.get_entity(
await self.session.get_input_entity(string))
self.session.get_input_entity(string))
except ValueError:
pass