Karta.Outbound.Sweeper (Karta v1.0.0)

Queues delivery again for recipients whose delivery job is gone.

A delivery job (Karta.Outbound.Deliverer) ends only when its recipients are final, and otherwise waits for the next of them to be due. A job that crashed on each of its attempts (Oban then discards it), or that was cancelled, leaves its recipients :queued or :deferred with nothing to deliver them. A sweep finds such recipients, unchanged for at least grace seconds (default 900), whose message and domain have no unfinished job, and inserts that job again (unique among the unfinished jobs, so two sweeps never double it). At most limit jobs (default 1000) per sweep. The new job delivers when the recipients are due, as before; the retry period still ends 5 days after they were queued. It goes into the queue of the server's IP pool.

A sweep also moves waiting delivery jobs that are not in their server's queue (Karta.Outbound.reroute/1): a job queued while its server's pool changed would otherwise wait in a queue no node may run.

It runs as an Oban cron job every 15 minutes (config :karta, Oban, cron: ...), on one node at a time.

Summary

Functions

One sweep. Returns the number of jobs queued again.

Functions

sweep(opts \\ [])

@spec sweep(keyword()) :: non_neg_integer()

One sweep. Returns the number of jobs queued again.