pub struct LocalIdentifyQueue { /* private fields */ }Expand description
The in-process IdentifyQueue: one IDENTIFY per rate-limit bucket every 5 seconds.
Shards of the same bucket identify one after another, in the order they asked; buckets
are independent. Share one queue (behind an Arc) between all shards of a process —
create_shards and cloned Configs do that.
discord.js counterpart: SimpleIdentifyThrottler from @discordjs/ws.
§Examples
use std::sync::Arc;
use djs_gateway::{Config, LocalIdentifyQueue};
use djs_model::gateway::Intents;
// `max_concurrency` comes from Get Gateway Bot's `session_start_limit`.
let queue = Arc::new(LocalIdentifyQueue::new(16));
let config = Config::builder("my-token", Intents::GUILDS)
.identify_queue(queue)
.build();Implementations§
Source§impl LocalIdentifyQueue
impl LocalIdentifyQueue
Sourcepub fn new(max_concurrency: u32) -> Self
pub fn new(max_concurrency: u32) -> Self
Creates a queue for a bot whose max_concurrency (from Get Gateway Bot’s
session_start_limit) is the given value. 0 is treated as 1.
discord.js counterpart: new SimpleIdentifyThrottler(maxConcurrency) (@discordjs/ws).
Sourcepub fn max_concurrency(&self) -> u32
pub fn max_concurrency(&self) -> u32
Returns the number of rate-limit buckets (the max_concurrency the queue was created
with, at least 1).
discord.js counterpart: the maxConcurrency of SimpleIdentifyThrottler (@discordjs/ws).