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

@@ -597,10 +597,7 @@ async def edit_message(
)
# Invoke `messages.editInlineBotMessage` from the right datacenter.
# Otherwise, Telegram will error with `MESSAGE_ID_INVALID` and do nothing.
# TODO should cache current session state
state = await self.session.get_state()
exported = state.dc_id != entity.dc_id
exported = self._session_state.dc_id != entity.dc_id
if exported:
try:
sender = await self._borrow_exported_sender(entity.dc_id)