-
Notifications
You must be signed in to change notification settings - Fork 598
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
Split GuildThread from GuildChannel #3026
base: next
Are you sure you want to change the base?
Conversation
4ba0fb5
to
f49dd03
Compare
d87a2db
to
037c2d6
Compare
16cc66c
to
f400ac4
Compare
This is ready for review, the main changes are:
The IDs have methods to convert between, such as:
|
f400ac4
to
0506c3b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good, not 100% sure if I like the name changes for PartialChannel, but I can't think of anything better right now so I think its passable.
I also think the naming could be improved since we are explicitly talking about channels and threads.
In that naming scheme I would name |
@peanutbother I don't fully understand how this "origin" naming improves things? From how I processed that I think you are saying |
I mean something like |
This was missing on FullEvent but was present within the event itself.
Values are getting quite close to the u8 limit (193), so let's preemptively bump this to avoid future breaking changes.
Moves the feature-gated collector methods on `UserId`, `MessageId`, etc. into four traits: - `CollectMessages` - `CollectReactions` - `CollectModalInteractions` - `CollectComponentInteractions` This also moves the quick modal machinery into the collector module and defines a `QuickModal` trait. This fully removes any collector feature gates from the model types.
This file was removed from the module tree but never actually deleted.
Fixes CI failure
…rs#3075) Similar to message URLs, Discord also provides URLs for guild channels. Additionally, the function is added as an alternative for parsing a `Channel` from a string. Private channels are not affected by this change.
The `Deserialize` implementation neglects to add the `Bot ` prefix to the string when it is deserialised. This adds `TryFrom` implementations for `&str` and `String` and tells serde to deserialise `Token` using the `TryFrom<&str>` implementation, which will prepend the `Bot ` prefix. Fixes serenity-rs#3085
This commit refactors how the gateway connection being closed gets handled, and also reworks how resuming is performed. If a resume fails, or if the session id is invalid/doesn't exist, the shard will fall back to restart + reidentify after a 1 second delay. This behavior was only present in some circumstances before. Also, cleaned up the loop in `ShardRunner::run` by adding a `ShardAction::Dispatch` variant, since event dispatch was already mutually exclusive to hearbeating, identifying, and restarting. The overall effect is less interleaving of control flow. Plus, removed the `Shard::{reconnect, reset}` functions as they were unused. A notable change is that 4006 is no longer considered a valid close code as it is undocumented, and neither is 1000, which tungstenite assigns as `Normal` or "clean". We should stick to the [table of close codes](https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes) provided by Discord.
A regression introduced by serenity-rs#3099 was that successful resumes will break out of the loop inside `ShardRunner::run`, but they shouldn't (or rather, didn't before). Therefore, only break out of the loop if the resume failed and we had to fallback to reidentifying.
…3111) As the title notes, this commit replaces fxhash for foldhash as used in the cache. dashmap, due to it's sharding, has to share entropy with what's handed down to internal maps. Since `hashbrown` and by extension `std` use various sections of the high bit range for special grouping & sorting, dashmap is left with the only option to shard on low bits. This, however, presents problems, because fxhash outputs hashes of very bad quality, with only the high bits having any real entropy. This was probably a solid choice back in 2018 when we lacked other good fast alternatives. But since then `ahash` matured and we've had significant research and development in "good enough" hashing for datastructures with short keys, [the most recent step forward coming from a rather well known face][foldhash]. This improves shard selection quite a bit and reduces contention significantly. Using fxhash in a dashmap specific benchmark causes contention to go up by 3-8x when keys are k-sortable with time (Discord snowflakes) on an M1 Pro. [foldhash]: https://github.com/orlp/foldhash
…s#3088) This replaces the time unit that determines how many messages in a period of X time should be deleted when a user is banned. Discord expresses this time in seconds, whereas Serenity exposed it in days. The limit is still 7 days, but with this, users of Serenity can be more precise with which messages they want to delete.
0506c3b
to
a36d4bc
Compare
57c79ff
to
9a811a7
Compare
This fixes #2991, via the solution voted for on the serenity discord.