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

@@ -213,7 +213,7 @@ class UploadMethods(ButtonMethods, MessageParseMethods, UserMethods):
entity, media=types.InputMediaUploadedPhoto(fh)
))
input_photo = utils.get_input_photo(r.photo)
await self.session.cache_file(fh.md5, fh.size, input_photo)
self.session.cache_file(fh.md5, fh.size, input_photo)
fh = input_photo
if captions:
@@ -328,7 +328,7 @@ class UploadMethods(ButtonMethods, MessageParseMethods, UserMethods):
file = stream.read()
hash_md5.update(file)
if use_cache:
cached = await self.session.get_file(
cached = self.session.get_file(
hash_md5.digest(), file_size, cls=use_cache
)
if cached:
@@ -459,6 +459,6 @@ class UploadMethods(ButtonMethods, MessageParseMethods, UserMethods):
to_cache = utils.get_input_photo(msg.media.photo)
else:
to_cache = utils.get_input_document(msg.media.document)
await self.session.cache_file(md5, size, to_cache)
self.session.cache_file(md5, size, to_cache)
# endregion