Immediatly update cached profile after changing it

This commit is contained in:
miruka
2020-06-02 20:59:33 -04:00
parent 5bf1a90242
commit 241c16932f
5 changed files with 16 additions and 10 deletions

View File

@@ -229,11 +229,13 @@ class Backend:
# Client functions that don't need authentification
async def get_profile(self, user_id: str) -> nio.ProfileGetResponse:
async def get_profile(
self, user_id: str, use_cache: bool = True,
) -> nio.ProfileGetResponse:
"""Cache and return the matrix profile of `user_id`."""
async with self.get_profile_locks[user_id]:
if user_id in self.profile_cache:
if use_cache and user_id in self.profile_cache:
return self.profile_cache[user_id]
client = await self.get_any_client()