Cache session_state and all_dcs right after connect

This commit is contained in:
Lonami Exo
2021-09-19 17:51:05 +02:00
parent 93dd2a186a
commit 545e9d69ce
5 changed files with 39 additions and 97 deletions

View File

@@ -39,10 +39,7 @@ class _DirectDownloadIter(requestiter.RequestIter):
self._msg_data = msg_data
self._timed_out = False
# TODO should cache current session state
state = await self.client.session.get_state()
self._exported = dc_id and state.dc_id != dc_id
self._exported = dc_id and self.client._session_state.dc_id != dc_id
if not self._exported:
# The used sender will also change if ``FileMigrateError`` occurs
self._sender = self.client._sender