From 4e34bbade4ffa41634d78495da3636b6479576eb Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 15 Nov 2021 18:31:34 +1100 Subject: [PATCH] Migrate `do_send_async` to `send` First log the warning, then attempt to send. This makes sure we always log the warning, even if we fail to send the message. --- daemon/src/maker_cfd.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/daemon/src/maker_cfd.rs b/daemon/src/maker_cfd.rs index d5a3b96..054603c 100644 --- a/daemon/src/maker_cfd.rs +++ b/daemon/src/maker_cfd.rs @@ -444,19 +444,19 @@ where load_order_by_id(current_order_id, &mut conn).await? } _ => { - self.takers - .do_send_async(maker_inc_connections::TakerMessage { - taker_id, - command: TakerCommand::NotifyInvalidOrderId { id: order_id }, - }) - .await?; - // An outdated order on the taker side does not require any state change on the // maker. notifying the taker with a specific message should be sufficient. // Since this is a scenario that we should rarely see we log // a warning to be sure we don't trigger this code path frequently. tracing::warn!("Taker tried to take order with outdated id {}", order_id); + self.takers + .send(maker_inc_connections::TakerMessage { + taker_id, + command: TakerCommand::NotifyInvalidOrderId { id: order_id }, + }) + .await??; + return Ok(()); } };