Skip to content

Commit

Permalink
is_connected fn
Browse files Browse the repository at this point in the history
  • Loading branch information
quellen-sol committed Jul 15, 2024
1 parent 1af48eb commit 0f06afb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/plugin/src/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl Sender {
async fn connect(&self) -> Result<RwLockReadGuard<Producer>, 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.
//
Expand Down
6 changes: 5 additions & 1 deletion crates/rabbitmq/src/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::serialize::serialize;
/// A producer consisting of a configured channel and additional queue config
#[derive(Debug)]
pub struct Producer<Q> {
pub chan: Channel,
chan: Channel,
ty: Q,
}

Expand Down Expand Up @@ -74,4 +74,8 @@ where

Ok(())
}

pub fn is_connected(&self) -> bool {
self.chan.status().connected()
}
}

0 comments on commit 0f06afb

Please sign in to comment.