Skip to main content

drain_change_log

Function drain_change_log 

Source
pub fn drain_change_log(
    pool: &PgPool,
    since: i64,
) -> impl Stream<Item = Result<ChangeRow>> + '_
Expand description

Stream every change with seq > since, in ascending seq order.

Use to recover from a LISTEN/NOTIFY gap: track last_seq, and call this on reconnect with that value to replay anything missed. The result is already ordered so the consumer can advance its cursor as it processes rows.

Errors from PG flow through the stream as Err(ForgeError::Database). The caller decides whether a transient error ends recovery or triggers a retry.