Sigra.Workers.EmailDelivery (Sigra v0.2.5)

Copy Markdown View Source

Oban worker for asynchronous email delivery.

Reconstructs email from type + args at delivery time. Never stores email body content in the jobs table (security: T-3-INFRA-01).

Job Args

  • "email_type" - String email type (e.g., "confirmation", "reset_password")
  • "user_id" - User ID to look up
  • "token" - Optional token for URL construction
  • "code" - Optional confirmation code
  • "url" - Optional pre-built URL

Runtime Config

The worker resolves host app modules from application env at runtime (D-22):

  • :repo - Ecto repo module
  • :user_schema - User schema module
  • :email_module - Module with email builder functions
  • :mailer - Module implementing Sigra.Mailer

Retry

max_attempts: 3, exponential backoff with jitter (~15s, ~60s). Non-retryable failures (user not found, unknown type) use {:cancel, reason}. Retryable failures (mailer error) use {:error, reason} for backoff retry.