From 7ce5ea47df0a4b1d8502dbf412f37bf52c056ac1 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 27 Sep 2021 19:47:20 +1000 Subject: [PATCH] Wait for message to be actually sent on the wire --- daemon/src/maker_cfd.rs | 4 +++- daemon/src/maker_inc_connections.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/daemon/src/maker_cfd.rs b/daemon/src/maker_cfd.rs index 1afe2a4..8326c49 100644 --- a/daemon/src/maker_cfd.rs +++ b/daemon/src/maker_cfd.rs @@ -289,12 +289,14 @@ impl Actor { .await .unwrap(); + // use `.send` here to ensure we only continue once the message has been sent self.takers - .do_send_async(maker_inc_connections::TakerMessage { + .send(maker_inc_connections::TakerMessage { taker_id, command: TakerCommand::NotifyOrderAccepted { id: msg.order_id }, }) .await?; + self.cfd_feed_actor_inbox .send(load_all_cfds(&mut conn).await?)?; diff --git a/daemon/src/maker_inc_connections.rs b/daemon/src/maker_inc_connections.rs index ae0a8a7..f3183de 100644 --- a/daemon/src/maker_inc_connections.rs +++ b/daemon/src/maker_inc_connections.rs @@ -61,7 +61,9 @@ impl Actor { .write_connections .get(&taker_id) .context("no connection to taker_id")?; - conn.do_send_async(msg).await?; + + // use `.send` here to ensure we only continue once the message has been sent + conn.send(msg).await?; Ok(()) }