aboutsummaryrefslogtreecommitdiff
path: root/discord/template.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-07-29 01:43:23 -0400
committerRapptz <[email protected]>2021-07-29 01:43:23 -0400
commitecf239d2a2e6ee8e027ca5fef9acf4564a9f3a09 (patch)
tree5a1b817691786602e4b0348b8a25b9d20277df13 /discord/template.py
parentAdd Guild.get_channel_or_thread helper method (diff)
downloaddiscord.py-ecf239d2a2e6ee8e027ca5fef9acf4564a9f3a09.tar.xz
discord.py-ecf239d2a2e6ee8e027ca5fef9acf4564a9f3a09.zip
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.
Diffstat (limited to 'discord/template.py')
-rw-r--r--discord/template.py2
1 files changed, 1 insertions, 1 deletions
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'))