Actually use the user cache

This commit is contained in:
Thomas Wade 2020-04-21 05:12:08 +09:30
parent 69ff0a40b8
commit d13ab3ba6e

View File

@ -57,10 +57,10 @@ class User:
@staticmethod @staticmethod
def new_or_cached(api, username: str): # -> User: def new_or_cached(api, username: str): # -> User:
if username in User._usercache: if username not in User._usercache:
return User._usercache[username] User._usercache[username] = User(api, username)
return User(api, username) return User._usercache[username]
def _get_gallery(self) -> List[Submission.Submission]: def _get_gallery(self) -> List[Submission.Submission]:
submissions = [] submissions = []