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(gateway): custom shard presences on identify #1474

Merged
merged 7 commits into from
Jan 22, 2022

Conversation

7596ff
Copy link
Contributor

@7596ff 7596ff commented Jan 20, 2022

Provides a function that takes a closure which allows setting a shard's presence based on its id.

Closes #1472.

Provides a function that takes a `HashMap<u64, UpdatePresencePayload>`
which customizes the presence of a shard's session.

Closes twilight-rs#1472.# one of build,chore,ci,docs,style,refactor,perf,test
@github-actions github-actions bot added c-gateway Affects the gateway crate t-feature Addition of a new feature labels Jan 20, 2022
@7596ff 7596ff requested review from Gelbpunkt and itohatweb January 21, 2022 16:33
Copy link
Member

@itohatweb itohatweb left a comment

Choose a reason for hiding this comment

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

Should we remove the presence methods now?

gateway/src/cluster/builder.rs Outdated Show resolved Hide resolved
gateway/src/cluster/impl.rs Outdated Show resolved Hide resolved
@Gelbpunkt
Copy link
Member

Should we remove the presence methods now?

I would be in favor of this. We could change ShardPresence to have an associated method to get an UpdatePresencePayload based on shard ID as a parameter and additionally implement ShardPresence for UpdatePresencePayload. This would allow removing presence with the same functionality preserved.

take an anonymous closure instead of a known type, implement debug for
Config
Copy link
Member

@Gelbpunkt Gelbpunkt left a comment

Choose a reason for hiding this comment

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

lgtm in the current state, more generic approaches can be added in a future PR

@7596ff 7596ff merged commit 91e2379 into twilight-rs:main Jan 22, 2022
@7596ff 7596ff deleted the feat/gateway/shard-presences branch January 22, 2022 23:36
7596ff added a commit that referenced this pull request Jan 23, 2022
Additions

Add `Information::{ratelimit_refill, ratelimit_requests}` to view how
much time until the shard ratelimiter resets and how many requests until
the next refill ([#1368] - [@itohatweb])

Add `ClusterBuilder::shard_presence`, which allows setting a custom
presence based on a shard's ID ([#1474] - [@7596ff]).

Changes

The `rustls` feature has been removed ([#1314] - [@Gelbpunkt]). Users
must manually select one of `rustls-native-roots` or
`rustls-webpki-roots`.

`{CommandErrorType, SendErrorType}::ExecutorShutDown` have been removed,
since they are no longer possible ([#1368] - [@itohatweb]).

No longer derive `Deserialize` and `Serialize` on `Information` ([#1368]
- [@itohatweb]).

The MSRV has been updated to 1.57 ([#1402] - [@zeylahellyer]).

The Rust edition has been updated to 2021 ([#1412] - [@vilgotf]).

Constructors that used to take `impl Into<String>` now simply accept a
`String` ([#1481] - [@vilgotf]).

[#1314]: #1314
[#1368]: #1368
[#1402]: #1402
[#1412]: #1412
[#1474]: #1474
[#1481]: #1481

[@7596ff]: https://github.com/7596ff
[@itohatweb]: https://github.com/itohatweb
[@Gelbpunkt]: https://github.com/Gelbpunkt
[@vilgotf]: https://github.com/vilgotf
[@zeylahellyer]: https://github.com/zeylahellyer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-gateway Affects the gateway crate t-feature Addition of a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set individual identify presence for specific shards when using Cluster
5 participants