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(Message): add messageEditHistoryMaxSize to limit stored msg edits #4867

Merged
merged 2 commits into from
Oct 17, 2020

Conversation

MattIPv4
Copy link
Contributor

Please describe the changes this PR makes and why it should be merged:

This fixes #4826 by adding a new client option to set a fixed limit on the edit history stored for each message in the client cache.

This has been tested in production on my bot (where the original memory issue was observed) for roughly a month and seems to be fine.

Status

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

Semantic versioning classification:

  • This PR changes the library's interface (methods or parameters added)
    • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)
  • This PR only includes non-code changes, like changes to documentation, README, etc.

@MattIPv4 MattIPv4 changed the title Limit message edit history feat(Message): add messageEditHistoryMaxSize to limit stored msg edits Sep 30, 2020
src/client/Client.js Outdated Show resolved Hide resolved
src/util/Constants.js Outdated Show resolved Hide resolved
src/structures/Message.js Outdated Show resolved Hide resolved
@MattIPv4 MattIPv4 force-pushed the limit-message-edit-history branch 3 times, most recently from 361f525 to 14f079d Compare September 30, 2020 20:17
src/structures/Message.js Outdated Show resolved Hide resolved
The messageEditHistoryMaxSize client option sets a hard limit for the maximum number of previous versions held in a message when it gets edited.
@MattIPv4
Copy link
Contributor Author

MattIPv4 commented Oct 4, 2020

Fixed the issue with messageUpdate not firing by changing Message#patch to return the old message clone, which can then be used when the event is fired. Method is private, so I assume this can remain minor.

@iCrawl iCrawl merged commit c412cd7 into discordjs:master Oct 17, 2020
GiorgioBrux pushed a commit to GiorgioBrux/discord.js that referenced this pull request Oct 17, 2020
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.

Excessive memory usage for message
10 participants