-
Notifications
You must be signed in to change notification settings - Fork 628
rework event handling to allow framework to be dispatched concurrently #3324
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arqunis
approved these changes
Mar 20, 2025
Closed
GnomedDev
pushed a commit
to GnomedDev/serenity
that referenced
this pull request
Mar 26, 2025
…erenity-rs#3324) The primary motivation for this change is to allow for concurrent execution of the event handler and the framework, but also brings other benefits: - The trait becomes much simpler, only having three functions now. - New fields to events will no longer be breaking changes.
GnomedDev
pushed a commit
to GnomedDev/serenity
that referenced
this pull request
Mar 26, 2025
…erenity-rs#3324) The primary motivation for this change is to allow for concurrent execution of the event handler and the framework, but also brings other benefits: - The trait becomes much simpler, only having three functions now. - New fields to events will no longer be breaking changes.
Closed
GnomedDev
pushed a commit
that referenced
this pull request
Apr 28, 2025
…3324) The primary motivation for this change is to allow for concurrent execution of the event handler and the framework, but also brings other benefits: - The trait becomes much simpler, only having three functions now. - New fields to events will no longer be breaking changes.
GnomedDev
pushed a commit
that referenced
this pull request
May 19, 2025
…3324) The primary motivation for this change is to allow for concurrent execution of the event handler and the framework, but also brings other benefits: - The trait becomes much simpler, only having three functions now. - New fields to events will no longer be breaking changes.
mkrasnitski
pushed a commit
to mkrasnitski/serenity
that referenced
this pull request
Jun 30, 2025
…erenity-rs#3324) The primary motivation for this change is to allow for concurrent execution of the event handler and the framework, but also brings other benefits: - The trait becomes much simpler, only having three functions now. - New fields to events will no longer be breaking changes.
mkrasnitski
pushed a commit
to mkrasnitski/serenity
that referenced
this pull request
Jun 30, 2025
…erenity-rs#3324) The primary motivation for this change is to allow for concurrent execution of the event handler and the framework, but also brings other benefits: - The trait becomes much simpler, only having three functions now. - New fields to events will no longer be breaking changes.
mkrasnitski
pushed a commit
to mkrasnitski/serenity
that referenced
this pull request
Jun 30, 2025
…erenity-rs#3324) The primary motivation for this change is to allow for concurrent execution of the event handler and the framework, but also brings other benefits: - The trait becomes much simpler, only having three functions now. - New fields to events will no longer be breaking changes.
mkrasnitski
pushed a commit
to mkrasnitski/serenity
that referenced
this pull request
Jul 28, 2025
…erenity-rs#3324) The primary motivation for this change is to allow for concurrent execution of the event handler and the framework, but also brings other benefits: - The trait becomes much simpler, only having three functions now. - New fields to events will no longer be breaking changes.
mkrasnitski
pushed a commit
to mkrasnitski/serenity
that referenced
this pull request
Jul 28, 2025
…erenity-rs#3324) The primary motivation for this change is to allow for concurrent execution of the event handler and the framework, but also brings other benefits: - The trait becomes much simpler, only having three functions now. - New fields to events will no longer be breaking changes.
mkrasnitski
pushed a commit
to mkrasnitski/serenity
that referenced
this pull request
Oct 7, 2025
…erenity-rs#3324) The primary motivation for this change is to allow for concurrent execution of the event handler and the framework, but also brings other benefits: - The trait becomes much simpler, only having three functions now. - New fields to events will no longer be breaking changes.
mkrasnitski
pushed a commit
to mkrasnitski/serenity
that referenced
this pull request
Oct 7, 2025
…erenity-rs#3324) The primary motivation for this change is to allow for concurrent execution of the event handler and the framework, but also brings other benefits: - The trait becomes much simpler, only having three functions now. - New fields to events will no longer be breaking changes.
mkrasnitski
pushed a commit
to mkrasnitski/serenity
that referenced
this pull request
Oct 7, 2025
…erenity-rs#3324) The primary motivation for this change is to allow for concurrent execution of the event handler and the framework, but also brings other benefits: - The trait becomes much simpler, only having three functions now. - New fields to events will no longer be breaking changes.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking change
The public API is changed, resulting in miscompilations or unexpected new behaviour for users
cache
Related to the `cache`-feature.
enhancement
An improvement to Serenity.
examples
Related to Serenity's examples.
gateway
Related to the `gateway` module.
model
Related to the `model` module.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I specifically decided to completely rework the way that users will handle events for a couple reasons:
The main reason for this PR to begin with was that the current pattern would allow commands in poise (which are done in the framework event handler) to block the execution of the regular event handler for an extended period of time (say, you were for example using a paginator, it would block for the entire duration of the command which would take a very long time with a paginator).
This PR should fix that by swapping the event handler to use references and then using
tokio::join!.Also the ratelimit one can't be handled the new way because Context isn't available and making it Option for a single event is wrong imo