Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Remove DM cache and fix references #1851

Merged
merged 2 commits into from
May 26, 2021

Conversation

SubZero0
Copy link
Member

Summary

Since GWv8 doesn't send channel creates for DMs anymore, I decided to stop caching them altogether.
This change should also have a positive impact on the cache size since DMs would never be removed from them while keeping a reference to the user, that would also be kept in memory forever.

Now the DMs and their authors won't be cached because of this change, the method GetOrCreateDMAsync was renamed to CreateDMAsync as it won't ever be cached.

A wrong method call in the client would also cause user objects to never be removed from the cache, this was also fixed.

Changes

  • DMs won't be cached anymore, so all methods related to cache in a SocketDMChannel will return null or do a rest request if allowed
  • GetOrCreateDMChannelAsync renamed to CreateDMChannelAsync
  • Remove wrong method call in the client, causing user objects to never be removed from the cache

@SubZero0 SubZero0 merged commit 7a201e9 into discord-net:dev May 26, 2021
@SubZero0 SubZero0 deleted the fix-dms-2 branch May 26, 2021 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant