Gateway: Add debug logging around shard handling

Adds some additional logging around some critical sections, rarely hit (i.e., during shard reconnections) in pursuit of issue #69. It's strongly suspected to lie here, at any rate...
This commit is contained in:
Kyle Simpson
2021-05-16 23:13:03 +01:00
parent 6d66b499e5
commit 0f54d18455
2 changed files with 38 additions and 1 deletions

View File

@@ -26,6 +26,7 @@ use std::sync::Arc;
use tokio::sync::Mutex;
#[cfg(feature = "tokio-02-marker")]
use tokio_compat::sync::Mutex;
use tracing::debug;
#[cfg(feature = "twilight")]
use twilight_gateway::Cluster;
#[cfg(feature = "twilight")]
@@ -390,15 +391,30 @@ impl Songbird {
#[async_trait]
impl VoiceGatewayManager for Songbird {
async fn initialise(&self, shard_count: u64, user_id: SerenityUser) {
debug!(
"Initialising Songbird for Serenity: ID {:?}, {} Shards",
user_id, shard_count
);
self.initialise_client_data(shard_count, user_id);
debug!("Songbird ({:?}) Initialised!", user_id);
}
async fn register_shard(&self, shard_id: u64, sender: Sender<InterMessage>) {
debug!(
"Registering Serenity shard handle {} with Songbird",
shard_id
);
self.sharder.register_shard_handle(shard_id, sender);
debug!("Registered shard handle {}.", shard_id);
}
async fn deregister_shard(&self, shard_id: u64) {
debug!(
"Deregistering Serenity shard handle {} with Songbird",
shard_id
);
self.sharder.deregister_shard_handle(shard_id);
debug!("Deregistered shard handle {}.", shard_id);
}
async fn server_update(&self, guild_id: SerenityGuild, endpoint: &Option<String>, token: &str) {