Delete session on log_out() even if telegram logout fails

This commit is contained in:
Tulir Asokan
2021-10-20 20:24:47 +03:00
parent 8865dab6b0
commit 4e8c373d1b
2 changed files with 3 additions and 4 deletions
+2 -3
View File
@@ -398,12 +398,11 @@ class User(AbstractUser, BaseUser):
self.tgid = None
await self.save()
ok = await self.client.log_out()
if not ok:
return False
self.client.session.delete()
self.delete()
await self.stop()
self._track_metric(METRIC_LOGGED_IN, False)
return True
return ok
def _search_local(self, query: str, max_results: int = 5, min_similarity: int = 45
) -> List[SearchResult]: