Resume accounts faster on client startup

This commit is contained in:
miruka 2019-12-16 05:14:26 -04:00
parent 7d8f67bfe2
commit 9da0b12e45
2 changed files with 4 additions and 4 deletions

View File

@ -1,13 +1,12 @@
import asyncio import asyncio
import logging as log import logging as log
from pathlib import Path from pathlib import Path
from typing import Any, DefaultDict, Dict, List, Optional, Tuple, Union from typing import Any, DefaultDict, Dict, List, Optional, Tuple
import hsluv import hsluv
import nio import nio
from . import utils
from .app import App from .app import App
from .errors import MatrixError from .errors import MatrixError
from .matrix_client import MatrixClient from .matrix_client import MatrixClient

View File

@ -134,8 +134,9 @@ class MatrixClient(nio.AsyncClient):
async def resume(self, user_id: str, token: str, device_id: str) -> None: async def resume(self, user_id: str, token: str, device_id: str) -> None:
response = nio.LoginResponse(user_id, device_id, token) self.user_id = user_id
await self.receive_response(response) self.access_token = token
self.device_id = device_id
asyncio.ensure_future(self.start()) asyncio.ensure_future(self.start())