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

Add a flag whether messages will save their JSON as a String #1006

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

felldo
Copy link
Member

@felldo felldo commented May 26, 2022

The intention of this PR is to be able to access the JSON of a message because there are situations where you may want to save the whole message in a database or in general just processing it.
An example use-case would be to parse the message if you have a dashboard without SSR an no access to Javacords environment.
Since this will also consume more memory and depending on the bots size this is an opt-in feature which you have to set first by setting DiscordApi#setSaveMessageJsonAsString to true.

If this gets accepted it would also be possible to do a follow-up PR where we can overload methods like getMessagesAsStream with a boolean parameter to only save the JSON for specific method calls in addition to having it as a global state

Memory comparison:

Without saving the string: 151.22 Mbyte
With saving the string: 354.13 Mbyte

So when saving the string, it uses ~ 2,3 more memory. This is the result of about 109'000 messages

@felldo felldo force-pushed the message-save-json-string branch 2 times, most recently from 3d59ed6 to 262ac90 Compare August 10, 2022 19:18
@felldo felldo requested a review from bassner August 12, 2022 09:34
@felldo felldo force-pushed the message-save-json-string branch 2 times, most recently from 2003576 to cb0b6c2 Compare November 20, 2022 19:13
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