-
-
Notifications
You must be signed in to change notification settings - Fork 132
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
Conversation
examples/gateway-reshard.rs
Outdated
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 { |
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.
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.
examples/gateway-reshard.rs
Outdated
+ (1..refills).map(|_| DAY).sum::<Duration>() | ||
+ Duration::from_secs(5 * buckets % total as u64) |
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.
These constants can be replaced by twilight-gateway-queue once #2228 lands
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.
Looks great, just needs a rebase.
Removes irrelevant code & comments.
d37acb5
to
6771df2
Compare
Removes irrelevant code & comments and improves identified heuristics.