From ecf239d2a2e6ee8e027ca5fef9acf4564a9f3a09 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Thu, 29 Jul 2021 01:43:23 -0400 Subject: Fix user cache acting incorrectly with evictions The first issue involved copied users which would lead to user updates causing faster evictions of the cache than was expected. The second issue involved users that weren't bound to an internal lifetime eviction policy. These users would not get evicted. For example, a user without mutual guilds or being part of the internal cache in general (messages, DMs) would never end up being evicted for some strange reason. To handle this case, store_user would get a counterpart named create_user which would create a user without potentially storing them in the cache. That way only users with a bound lifetime within the library would be stored. --- discord/template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'discord/template.py') diff --git a/discord/template.py b/discord/template.py index 045e1878..12429c71 100644 --- a/discord/template.py +++ b/discord/template.py @@ -137,7 +137,7 @@ class Template: self.name = data['name'] self.description = data['description'] creator_data = data.get('creator') - self.creator = None if creator_data is None else self._state.store_user(creator_data) + self.creator = None if creator_data is None else self._state.create_user(creator_data) self.created_at = parse_time(data.get('created_at')) self.updated_at = parse_time(data.get('updated_at')) -- cgit v1.2.3