Wait for RPC connection before sending notice to log back in

This commit is contained in:
Andrew Ferrazzutti 2022-05-10 01:11:27 -04:00
parent 20bdbf9cd1
commit 8da7f1efbd
2 changed files with 7 additions and 0 deletions

View File

@ -109,6 +109,10 @@ class Client:
await cls._rpc_client.connect() await cls._rpc_client.connect()
await cls._rpc_client.wait_for_disconnection() await cls._rpc_client.wait_for_disconnection()
@classmethod
def wait_for_connection(cls) -> Awaitable[None]:
return cls._rpc_client.wait_for_connection()
@classmethod @classmethod
def stop_cls(cls) -> None: def stop_cls(cls) -> None:
"""Stop and disconnect from the Node backend.""" """Stop and disconnect from the Node backend."""

View File

@ -388,6 +388,9 @@ class User(DBUser, BaseUser):
) -> None: ) -> None:
try: try:
if not await self._load_session(is_startup=is_startup) and self.has_state: if not await self._load_session(is_startup=is_startup) and self.has_state:
self.log.debug("reload_session failure: wait for connection to Node module before prompting for manual login")
await Client.wait_for_connection()
self.log.debug("reload_session failure: now connected to Node module")
await self.send_bridge_notice( await self.send_bridge_notice(
"Logged out of KakaoTalk. Must use the `login` command to log back in.", "Logged out of KakaoTalk. Must use the `login` command to log back in.",
important=True, important=True,