Skip to content

Emails 0.1.17: Manual polls run even when background polling is off

Emails 0.1.17 makes a manual poll for delivery events actually run, and keeps the background polling chains to exactly one scheduled job each.

A manual SQS poll did nothing while SQS polling was switched off, the case it is most needed for, even though the log said it was running. It also moved the regular chain’s next run to now. Manual polls for SQS and for Brevo, including the Poll now button in the Brevo settings, now run one cycle whatever the background toggle says, without touching the regular schedule. The other checks still apply: the email system must be on and a send profile must use the provider.

Turning polling off no longer deletes queued jobs. The next job sees the switch is off and ends the chain itself.

Full release notes: Emails 0.1.17

0.1.17 · 26 July 2026

Changed

  • Both polling chains (SQSPollingJob, BrevoPollingJob) now guarantee “exactly one queued future job” with Oban’s own uniqueness instead of a manual delete-then-insert. The workers carry unique: [period: :infinity, states: [:scheduled]] (:executing deliberately excluded — Oban’s conflict check has no self-exclusion, so a self-rescheduling job would match its own row and stall the chain every cycle), and the managers’ immediate inserts use a per-call unique: [:available, :scheduled] + replace: [scheduled_at] override so enabling while a tick is already queued moves that job up rather than appending a second one. cancel_scheduled/0 is gone from both jobs, and disable_polling/0 no longer deletes anything — the queued job’s own should_poll?/0 check ends the chain on its next tick. (#21)
  • BrevoPollingManager.poll_now/0 now inserts args: %{"forced" => true}, which BrevoPollingJob.perform/1 honours by running one cycle regardless of the brevo_events_enabled toggle (still subject to Emails.enabled?/0 and the sender-aware gate). The distinct args also keep manual polls in their own uniqueness namespace, so they never move or cancel the regular chain’s next scheduled tick. (#21)

Fixed

  • SQSPollingManager.poll_now/0 was a silent no-op whenever SQS polling was disabled — the one case an operator is most likely to use it. It inserted a job with the regular chain’s args, which SQSPollingJob.perform/1 then dropped on its should_poll?/0 gate, even though the manager logged “Polling is disabled, but executing manual poll”. It now inserts a forced job (args: %{"forced" => true}) that bypasses the sqs_polling_enabled toggle for that single cycle, mirroring Brevo; Emails.enabled?/0, the SES-events switch, and the sender-aware profile gate are still enforced, and schedule_next_poll/1 still refuses to resurrect the chain. (#21)
  • SQSPollingManager.poll_now/0 also reset the regular chain’s cadence: sharing the regular chain’s args made its unique/replace insert conflict with the already-scheduled next tick and move that job’s scheduled_at to now. Manual polls are now independent of the chain. (#21)

Emails 0.1.17. Install or update: {:phoenix_kit_emails, "~> 0.1"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.