Skip to content

Commit

Permalink
Force reconnection to rabbitmq if current connection is errored
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyBuisset committed Sep 28, 2023
1 parent ec802a1 commit 9c16b68
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/infrastructure/src/amqp/bus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ lazy_static! {
async fn connect(config: Config) -> Result<Arc<Connection>, Error> {
let mut guard = CONNECTION.lock().await;
match guard.as_ref().and_then(Weak::upgrade) {
Some(connection) => Ok(connection),
None => {
Some(connection) if connection.status().connected() => Ok(connection),
_ => {
let connection = Arc::new(_do_connect(config).await?);
*guard = Some(Arc::downgrade(&connection));
Ok(connection)
Expand Down

0 comments on commit 9c16b68

Please sign in to comment.