pub async fn subscribe_delivered(pool: &Pool, id: i64) -> Result<(), Error>Expand description
Wait until the message_queue row identified by id has been
consumed — i.e. its active column has flipped from TRUE to
FALSE. Resolves Ok(()) the moment the flip is observed,
regardless of which path performed it.
Uses sqlx::postgres::PgListener on the
message_queue_inactive channel that the AFTER-UPDATE trigger
in db::init populates. The function attaches the listener
FIRST, then re-checks whether the row is still active — that’s
what closes the window where a fast flip races our LISTEN.