Browse Source

Migrate `do_send_async` to `send`

First clean up state, then attempt to send the message. If it fails,
we bubble up but leave things in a consistent state.
pAndLAndPayout
Thomas Eizinger 3 years ago
parent
commit
a253a62582
No known key found for this signature in database GPG Key ID: 651AC83A6C6C8B96
  1. 22
      daemon/src/maker_cfd.rs

22
daemon/src/maker_cfd.rs

@ -375,15 +375,18 @@ where
let taker_id = self.get_taker_id_of_proposal(&order_id)?;
// clean-up state ahead of sending to ensure consistency in case we fail to deliver the
// message
self.remove_pending_proposal(&order_id)
.context("rejected settlement")?;
self.takers
.do_send_async(maker_inc_connections::TakerMessage {
.send(maker_inc_connections::TakerMessage {
taker_id,
command: TakerCommand::NotifySettlementRejected { id: order_id },
})
.await?;
.await??;
self.remove_pending_proposal(&order_id)
.context("rejected settlement")?;
Ok(())
}
@ -404,15 +407,18 @@ where
}
};
// clean-up state ahead of sending to ensure consistency in case we fail to deliver the
// message
self.remove_pending_proposal(&order_id)
.context("rejected roll_over")?;
self.takers
.do_send_async(maker_inc_connections::TakerMessage {
.send(maker_inc_connections::TakerMessage {
taker_id,
command: TakerCommand::NotifyRollOverRejected { id: order_id },
})
.await?;
.await??;
self.remove_pending_proposal(&order_id)
.context("rejected roll_over")?;
Ok(())
}
}

Loading…
Cancel
Save