Skip to main content

annotate_expiring

Function annotate_expiring 

Source
pub async fn annotate_expiring(
    orders: Vec<Order>,
    database: &Database,
) -> Result<Vec<ExpiringEntry>, Error>
Expand description

Annotates a whole listing with days_remaining and superseded_by.

The per-account cache is load-bearing rather than an optimisation. Order::find_by_account is unbounded, and the identifier signal needs it per row: a fifty-row page over one account read that account’s entire order history fifty times, and order list --expiring-in is unpaged, so the same shape over a year-old CA is arbitrarily worse. One read per distinct account is the same answer for a bounded amount of work.

The replaces signal stays per row: it is a keyed lookup and a chain parse, and there is nothing to share between two rows.