mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 01:16:35 +03:00
Don't unnecessarily refetch the sender twice
This commit is contained in:
parent
299b090cde
commit
db29e9b7ef
|
@ -46,11 +46,14 @@ class SenderGetter(abc.ABC):
|
|||
# cached information, they may use the property instead.
|
||||
if (self._sender is None or getattr(self._sender, 'min', None)) \
|
||||
and await self.get_input_sender():
|
||||
try:
|
||||
self._sender =\
|
||||
await self._client.get_entity(self._input_sender)
|
||||
except ValueError:
|
||||
await self._refetch_sender()
|
||||
# self.get_input_sender may refresh in which case the sender may no longer be min
|
||||
# However it could still incur a cost so the cheap check is done twice instead.
|
||||
if self._sender is None or getattr(self._sender, 'min', None):
|
||||
try:
|
||||
self._sender =\
|
||||
await self._client.get_entity(self._input_sender)
|
||||
except ValueError:
|
||||
await self._refetch_sender()
|
||||
return self._sender
|
||||
|
||||
@property
|
||||
|
|
Loading…
Reference in New Issue
Block a user