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

feat: allow disabling of guild and channel caches #895

Merged
merged 8 commits into from
Sep 27, 2023

Conversation

braindigitalis
Copy link
Contributor

This PR adds support for disabling the guild or channel cache completely, saving potentially gigabytes of ram at scale.
This needs some testing before it can be pushed to dev. I shall be testing it over the next few days.

Note that if you disable a cache, certain events may deliver a nullptr instead of the expected structure, e.g. if you disabled guild cache, on_guild_delete is going to give you nullptr as the guild being deleted as discord do not provide the 'old' data.

I have also added a new namespace dpp::cache_policy that contains three simple constexpr's as shorthand for generic cache policies that people might want to use: default, balanced, or none. Default is what DPP has always used, balanced is what triviabot is using right now and none is what it will use in the future.

users who are exclusively using slash commands and the resolved set there will be able to move to the disabled cache setting with minimal migration difficulty.

Code change checklist

  • I have ensured that all methods and functions are fully documented using doxygen style comments.
  • My code follows the coding style guide.
  • I tested that my change works before raising the PR.
  • I have ensured that I did not break any existing API calls.
  • I have not built my pull request using AI, a static analysis tool or similar without any human oversight.

@netlify
Copy link

netlify bot commented Sep 27, 2023

Deploy Preview for dpp-dev ready!

Name Link
🔨 Latest commit 4dbd985
🔍 Latest deploy log https://app.netlify.com/sites/dpp-dev/deploys/65144427a998d00008ab7446
😎 Deploy Preview https://deploy-preview-895--dpp-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Sep 27, 2023
@braindigitalis braindigitalis self-assigned this Sep 27, 2023
@braindigitalis braindigitalis added enhancement New feature or request project labels Sep 27, 2023
src/dpp/events/channel_delete.cpp Show resolved Hide resolved
src/dpp/events/guild_members_chunk.cpp Outdated Show resolved Hide resolved
src/dpp/events/guild_update.cpp Show resolved Hide resolved
src/dpp/events/guild_role_create.cpp Show resolved Hide resolved
src/dpp/events/channel_update.cpp Outdated Show resolved Hide resolved
src/dpp/events/channel_create.cpp Show resolved Hide resolved
src/dpp/events/guild_emojis_update.cpp Outdated Show resolved Hide resolved
src/dpp/events/guild_create.cpp Outdated Show resolved Hide resolved
src/dpp/events/guild_create.cpp Show resolved Hide resolved
Copy link
Member

@Mishura4 Mishura4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like the super abbreviated variable names and wish we'd use more explicit naming. Other than that I'm not familiar with the cache system in D++, but looks good to me generally.

Copy link
Contributor

@raxyte raxyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can fix storing the role id vector in another PR. Thanks!

@braindigitalis braindigitalis merged commit 90f63df into dev Sep 27, 2023
50 checks passed
@Jaskowicz1 Jaskowicz1 deleted the allow_disable_channel_guild_cache branch April 4, 2024 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants