Skip to main content

Module queue

Module queue 

Source
Expand description

Queue row type, status enum, and retry-attempt bookkeeping.

Re-exports§

pub use suppression::is_hard_bounce;
pub use suppression::add_suppression;
pub use suppression::is_suppressed;
pub use suppression::list_suppressions;
pub use suppression::remove_suppression;

Modules§

suppression
Suppression list (hard-bounce blocklist).

Structs§

QueuedMessage
One queued outbound message — the full row stored in the outbound queue.

Enums§

QueueStatus
Lifecycle status of a queued message.

Functions§

cancel_pending
cancel a pending outbound message (undo send)
cancel_pending_by_message_id
cancel a pending outbound message by message_id (undo send)
claim_for_delivery
Atomically claim up to limit pending messages and transition them to inflight, returning the claimed rows.
count_inflight
Count of rows in status = 'inflight' (currently being delivered by a worker). Used alongside count_pending so dashboards can show both “queued” and “in-flight” depth.
count_pending
Count of rows in status = 'pending' (any next_retry). Used by the delivery worker to publish a mailrs_outbound_queue_depth gauge per poll tick. O(rows) but cheap with the status index.
dequeue
fetch pending messages ready for delivery (legacy, non-atomic).
enqueue
enqueue a message for outbound delivery
enqueue_ex
enqueue a message for outbound delivery with forwarding flag
enqueue_scheduled
enqueue a message for scheduled delivery at a future time
get_message
get a specific queued message by id
list_recent
list recent queue entries for admin UI
mark_bounced
mark a message as permanently bounced
mark_delivered
mark a message as delivered
mark_failed
mark a message as failed with next retry time
mark_inflight
mark a message as in-flight
notify
notify the delivery worker that new messages are queued via the in-process kevy queue:notify channel.
queue_stats
get queue statistics
recover_stale_inflight
recover messages stuck in inflight status for more than 10 minutes (worker crashed or was killed before marking them as delivered/failed)
reschedule_pending
move a still-pending message’s delivery time to scheduled_at
retry_message
reset a bounced/failed message back to pending for retry