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

docs(gateway): cleanup reshard example #2224

Merged
merged 1 commit into from
Dec 29, 2023

Conversation

vilgotf
Copy link
Member

@vilgotf vilgotf commented Jun 22, 2023

Removes irrelevant code & comments and improves identified heuristics.

@github-actions github-actions bot added the t-docs A change to the documentation label Jun 22, 2023
@vilgotf vilgotf enabled auto-merge (squash) July 1, 2023 15:22
@vilgotf vilgotf requested a review from a team July 17, 2023 06:30
examples/gateway-reshard.rs Outdated Show resolved Hide resolved
examples/gateway-reshard.rs Outdated Show resolved Hide resolved
let mut stream = ShardMessageStream::new(shards.iter_mut());

// Drive the new list of shards until they are all identified.
while !identified.iter().all(|&shard| shard) {
while identified.iter().sum::<usize>() < (identified.len() * 3) / 4 {
Copy link
Member

@Gelbpunkt Gelbpunkt Jul 18, 2023

Choose a reason for hiding this comment

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

We should also be able to employ some better heuristics here if we want to take it further. Since we already call the get gateway endpoint, we can calculate the estimated time until which the shards should be identified. We could combine a sleep for that with the 75% identified goal to avoid returning a bit too early. Not sure how much benefit that little bit of added complexity would bring though.

@vilgotf vilgotf requested a review from Gelbpunkt July 19, 2023 08:06
Comment on lines 144 to 145
+ (1..refills).map(|_| DAY).sum::<Duration>()
+ Duration::from_secs(5 * buckets % total as u64)
Copy link
Member Author

Choose a reason for hiding this comment

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

These constants can be replaced by twilight-gateway-queue once #2228 lands

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.

Looks great, just needs a rebase.

Removes irrelevant code & comments.
@Gelbpunkt Gelbpunkt force-pushed the vilgotf/docs/cleanup-gateway-reshard branch from d37acb5 to 6771df2 Compare December 23, 2023 14:19
@vilgotf vilgotf merged commit 20d3e29 into main Dec 29, 2023
10 checks passed
@vilgotf vilgotf deleted the vilgotf/docs/cleanup-gateway-reshard branch December 29, 2023 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t-docs A change to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants