Skip to content

Conversation

@vilgotf
Copy link
Member

@vilgotf vilgotf commented Jan 27, 2023

The create_* set of functions in the stream module have a severe quirk, they would not set a shared Queue (users can set one themselves so we can't override it).

This PR resolves this pain point by simply removing these functions, which is possible without loosing the TLS reuse optimization as Config implements Clone. Still, users must be guided to reuse their Config, which is why this PR also removes the Shard::new function, leaving only Shard::with_config which takes a Config, however, this naming scheme is unusual, so the Shard::with_config function was also renamed to Shard::new.

Todo

  • Update all examples
  • Update documentation
    • Provide migration examples from the old (0.14) ShardScheme variants—belongs in the migration guide instead
    • Document escape hatch of reusing the TLS session, but setting other different settings (such as token and Queue), through cloning an existing Config, passing that to ConfigBuilder::with_config and then building a new Config
  • Remove the unused twilight-http gateway feature

@vilgotf vilgotf added c-gateway Affects the gateway crate m-breaking change Breaks the public API. t-refactor Refactors APIs or code. labels Jan 27, 2023
@vilgotf vilgotf force-pushed the vilgotf/gateway/refactor/create-shards branch 2 times, most recently from 9e1a9c5 to 7c649aa Compare January 27, 2023 10:02
@github-actions github-actions bot added the c-book Affects the book label Jan 27, 2023
@vilgotf vilgotf added the t-docs A change to the documentation label Jan 27, 2023
@vilgotf vilgotf force-pushed the vilgotf/gateway/refactor/create-shards branch from 7c649aa to 5ce7ec8 Compare January 27, 2023 10:12
@github-actions github-actions bot added c-all Affects all crates or the project as a whole c-cache Affects the cache crate labels Jan 27, 2023
@vilgotf vilgotf force-pushed the vilgotf/gateway/refactor/create-shards branch 4 times, most recently from d48f482 to 51a6752 Compare January 27, 2023 10:28
@github-actions github-actions bot added the c-http Affects the http crate label Jan 27, 2023
@vilgotf vilgotf force-pushed the vilgotf/gateway/refactor/create-shards branch 4 times, most recently from b94d758 to 901bc18 Compare January 27, 2023 10:57
@github-actions github-actions bot added c-lavalink Affects the lavalink crate c-standby Affects the standby crate t-ci Anything to do with CI. labels Jan 27, 2023
@vilgotf vilgotf force-pushed the vilgotf/gateway/refactor/create-shards branch 2 times, most recently from 55c2d71 to 3943c3b Compare January 27, 2023 21:50
@vilgotf vilgotf marked this pull request as ready for review January 27, 2023 21:50
@vilgotf vilgotf force-pushed the vilgotf/gateway/refactor/create-shards branch from 3943c3b to 728bd9e Compare January 27, 2023 21:54
@vilgotf vilgotf force-pushed the vilgotf/gateway/refactor/create-shards branch from 728bd9e to 58ac7ac Compare January 28, 2023 07:22
@github-actions github-actions bot removed the c-http Affects the http crate label Jan 28, 2023
@vilgotf vilgotf force-pushed the vilgotf/gateway/refactor/create-shards branch from 58ac7ac to 45d9d86 Compare January 28, 2023 07:25
@vilgotf vilgotf force-pushed the vilgotf/gateway/refactor/create-shards branch from 45d9d86 to 21b1452 Compare January 28, 2023 07:34
@vilgotf
Copy link
Member Author

vilgotf commented Jan 28, 2023

I split this PR into multiple commits to ease discussions about whether some of them should be split out into separate PRs

@7596ff 7596ff removed t-docs A change to the documentation t-ci Anything to do with CI. labels Jan 29, 2023
@vilgotf vilgotf force-pushed the vilgotf/gateway/refactor/create-shards branch from 21b1452 to 48fc517 Compare February 1, 2023 07:57
@github-actions github-actions bot added the t-ci Anything to do with CI. label Feb 1, 2023
7596ff added a commit that referenced this pull request Feb 4, 2023
Instead of removing these functions entirely, accept a primary `Config`,
which is then subsequently optionally modified in the callback. The
default config creates the default queue, which is then cloned and
re-built before it passed to each shard. It also re-uses the TLS
container.

Alternative to #2090.
@vilgotf vilgotf closed this Feb 5, 2023
@vilgotf
Copy link
Member Author

vilgotf commented Feb 5, 2023

Not happening

7596ff added a commit that referenced this pull request Feb 5, 2023
…2116)

Instead of removing these functions entirely, accept a primary `Config`,
which is then subsequently optionally modified in the callback. The
default config creates the default queue, which is then cloned and
re-built before it passed to each shard. It also re-uses the TLS
container.

Alternative to #2090.

Co-authored-by: Zeyla Hellyer <[email protected]>
Co-authored-by: Tim Vilgot Mikael Fredenberg <[email protected]>
@vilgotf vilgotf deleted the vilgotf/gateway/refactor/create-shards branch September 15, 2023 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c-all Affects all crates or the project as a whole c-book Affects the book c-cache Affects the cache crate c-gateway Affects the gateway crate c-lavalink Affects the lavalink crate c-standby Affects the standby crate m-breaking change Breaks the public API. t-ci Anything to do with CI. t-refactor Refactors APIs or code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants