mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
fix(gateway): only send relevant events to shard state manager
This commit is contained in:
parent
05817afdba
commit
73103dc2b5
2 changed files with 10 additions and 7 deletions
|
|
@ -175,6 +175,7 @@ pub async fn runner(
|
||||||
.increment(1);
|
.increment(1);
|
||||||
|
|
||||||
// update shard state and discord cache
|
// update shard state and discord cache
|
||||||
|
if matches!(event, Event::Ready(_)) || matches!(event, Event::Resumed) {
|
||||||
if let Err(error) = tx_state.try_send((
|
if let Err(error) = tx_state.try_send((
|
||||||
shard.id(),
|
shard.id(),
|
||||||
ShardStateEvent::Other,
|
ShardStateEvent::Other,
|
||||||
|
|
@ -183,6 +184,7 @@ pub async fn runner(
|
||||||
)) {
|
)) {
|
||||||
tracing::error!(?error, "error updating shard state");
|
tracing::error!(?error, "error updating shard state");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// need to do heartbeat separately, to get the latency
|
// need to do heartbeat separately, to get the latency
|
||||||
let latency_num = shard
|
let latency_num = shard
|
||||||
.latency()
|
.latency()
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ pub fn new(redis: RedisPool) -> ShardStateManager {
|
||||||
impl ShardStateManager {
|
impl ShardStateManager {
|
||||||
pub async fn handle_event(&self, shard_id: u32, event: Event) -> anyhow::Result<()> {
|
pub async fn handle_event(&self, shard_id: u32, event: Event) -> anyhow::Result<()> {
|
||||||
match event {
|
match event {
|
||||||
|
// also update gateway.rs with event types
|
||||||
Event::Ready(_) => self.ready_or_resumed(shard_id, false).await,
|
Event::Ready(_) => self.ready_or_resumed(shard_id, false).await,
|
||||||
Event::Resumed => self.ready_or_resumed(shard_id, true).await,
|
Event::Resumed => self.ready_or_resumed(shard_id, true).await,
|
||||||
_ => Ok(()),
|
_ => Ok(()),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue