[][src]Struct twilight_gateway_queue::LocalQueue

pub struct LocalQueue(_);

A local, in-process implementation of a Queue which manages the connection attempts of one or more shards.

The queue will take incoming requests and then queue them, releasing one of the requests every 6 seconds. The queue is necessary because there's a ratelimit on how often shards can initiate sessions.

You usually won't need to handle this yourself, because the Cluster will do that for you when managing multiple shards.

When not to use this

This queue implementation is "local", meaning it's intended to be used if you manage shards only in this process. If you run shards in multiple different processes (do you utilize microservices a lot?), then you must not use this implementation. Shards across multiple processes may create new sessions at the same time, which is bad.

It should also not be used for very large sharding, for that the LargeBotQueue can be used.

If you can't use this, look into an alternative implementation of the Queue, such as the gateway-queue broker.

Implementations

impl LocalQueue[src]

pub fn new() -> Self[src]

Creates a new local queue.

Trait Implementations

impl Clone for LocalQueue[src]

impl Debug for LocalQueue[src]

impl Default for LocalQueue[src]

impl Queue for LocalQueue[src]

pub fn request(
    &self,
    [id, total]: [u64; 2]
) -> Pin<Box<dyn Future<Output = ()> + Send>>
[src]

Request to be able to identify with the gateway. This will place this request behind all other requests, and the returned future will resolve once the request has been completed.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,