diff --git a/crates/plugin/src/sender.rs b/crates/plugin/src/sender.rs index 73255b0..4736bd2 100644 --- a/crates/plugin/src/sender.rs +++ b/crates/plugin/src/sender.rs @@ -88,7 +88,7 @@ impl Sender { async fn connect(&self) -> Result, indexer_rabbitmq::Error> { let mut producer = self.producer.write().await; - if producer.chan.status().connected() { + if producer.is_connected() { // This thread was in line for a write, // but another thread has already handled the reconnection. // diff --git a/crates/rabbitmq/src/producer.rs b/crates/rabbitmq/src/producer.rs index c946d3e..cc46798 100644 --- a/crates/rabbitmq/src/producer.rs +++ b/crates/rabbitmq/src/producer.rs @@ -12,7 +12,7 @@ use crate::serialize::serialize; /// A producer consisting of a configured channel and additional queue config #[derive(Debug)] pub struct Producer { - pub chan: Channel, + chan: Channel, ty: Q, } @@ -74,4 +74,8 @@ where Ok(()) } + + pub fn is_connected(&self) -> bool { + self.chan.status().connected() + } }