[−][src]Struct serenity::client::bridge::gateway::ShardQueuer
The shard queuer is a simple loop that runs indefinitely to manage the startup of shards.
A shard queuer instance should be run in its own thread, due to the blocking nature of the loop itself as well as a 5 second thread sleep between shard starts.
Fields
data: Arc<RwLock<ShareMap>>
A copy of Client::data
to be given to runners for contextual
dispatching.
event_handler: Option<Arc<H>>
A reference to an EventHandler
, such as the one given to the
Client
.
raw_event_handler: Option<Arc<RH>>
A reference to an RawEventHandler
, such as the one given to the
Client
.
framework: Arc<Mutex<Option<Box<dyn Framework + Send>>>>
A copy of the framework
last_start: Option<Instant>
The instant that a shard was last started.
This is used to determine how long to wait between shard IDENTIFYs.
manager_tx: Sender<ShardManagerMessage>
A copy of the sender channel to communicate with the
ShardManagerMonitor
.
queue: VecDeque<(u64, u64)>
The shards that are queued for booting.
This will typically be filled with previously failed boots.
runners: Arc<Mutex<HashMap<ShardId, ShardRunnerInfo>>>
A copy of the map of shard runners.
rx: Receiver<ShardQueuerMessage>
A receiver channel for the shard queuer to be told to start shards.
threadpool: ThreadPool
A copy of a threadpool to give shard runners.
For example, when using the Client
, this will be a copy of
Client::threadpool
.
voice_manager: Arc<Mutex<ClientVoiceManager>>
A copy of the client's voice manager.
ws_url: Arc<Mutex<String>>
A copy of the URI to use to connect to the gateway.
cache_and_http: Arc<CacheAndHttp>
Methods
impl<H: EventHandler + Send + Sync + 'static, RH: RawEventHandler + Send + Sync + 'static> ShardQueuer<H, RH>
[src]
pub fn run(&mut self)
[src]
Begins the shard queuer loop.
This will loop over the internal rx
for ShardQueuerMessage
s,
blocking for messages on what to do.
If a ShardQueuerMessage::Start
is received, this will:
- Check how much time has passed since the last shard was started
- If the amount of time is less than the ratelimit, it will sleep until that time has passed
- Start the shard by ID
If a ShardQueuerMessage::Shutdown
is received, this will return and
the loop will be over.
Note: This should be run in its own thread due to the blocking nature of the loop.
Auto Trait Implementations
impl<H, RH> !Sync for ShardQueuer<H, RH>
impl<H, RH> Send for ShardQueuer<H, RH>
impl<H, RH> Unpin for ShardQueuer<H, RH>
impl<H, RH> !RefUnwindSafe for ShardQueuer<H, RH>
impl<H, RH> !UnwindSafe for ShardQueuer<H, RH>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> Erased for T
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,
impl<T> UnsafeAny for T where
T: Any,
T: Any,