Skip to main content

gate_checked_after_the_queue

Function gate_checked_after_the_queue 

Source
pub async fn gate_checked_after_the_queue<U, A, AFut, D, DFut, R, RFut>(
    ud: &U,
    rx: &mut Receiver<Envelope>,
    id: &InstrumentId,
    price: Price,
    in_flight: A,
    degrade: D,
    release: R,
)
where U: OrderExecutor + ?Sized, A: FnOnce() -> AFut, AFut: Future<Output = ()>, D: FnOnce() -> DFut, DFut: Future<Output = ()>, R: FnOnce() -> RFut, RFut: Future<Output = ()>,
Expand description

A command that waits in the queue of its instrument is checked against the gate again when its turn comes: a gate that closed meanwhile stops it, and nothing is sent.

Two places on one instrument go out together. The first is held at the broker (in_flight returns when the broker has it in hand), the second waits in the queue of the instrument. Then degrade closes the gate (it breaks the order streams) and the test waits for the Reconnected event, and release lets the broker finish the first one. Checks:

  • the first place is Ok or Unknown (it was sent before the gate closed);
  • the second is [Error::Degraded]: it did not go out after the queue;
  • after reconcile(&[]), of the two cids only the first is at the broker. Both are cancelled.

§Panics

With [conformance:gate_checked_after_the_queue] <reason>.