Repository navigation
Relay fix hard-stop: real pause/resume/stop for SENDING campaigns - #76
Open
alexeygrigorev wants to merge 1 commit into
Open
alexeygrigorev wants to merge 1 commit into
alexeygrigorev wants to merge 1 commit into
Conversation
alexeygrigorev
force-pushed
the
relay-fix-hard-stop
branch
4 times, most recently
from
November 9, 2026 14:03
c362b1b to
8e01ae4
Compare
Lock-free halt flag (Campaign.send_halted_at + send_halt_reason) set by a
plain UPDATE so pause/stop never wait behind senders' FOR SHARE locks. The
sender reads the flag with a plain SELECT before every SES call and in the
drain loop; once seen, no further SES calls happen in that batch and
remaining PENDING recipients are left untouched and resumable.
Pause keeps the campaign SENDING and is resumable (resume clears the flag
and re-enqueues batches for remaining PENDING only); stop moves it to
CANCELLED permanently with sent rows kept. New API endpoints
POST /api/campaigns/<key>/{pause,resume,stop} plus operator UI buttons for
queued/sending campaigns, with visible errors on failure.
Retryable SES throttling no longer fails the batch at the task layer: the
remaining PENDING recipients of the batch are requeued as a new task with
run_after backoff and bounded attempts (RELAY_CAMPAIGN_THROTTLE_*),
logged loudly; exhaustion re-raises.
alexeygrigorev
force-pushed
the
relay-fix-hard-stop
branch
from
November 9, 2026 14:07
8e01ae4 to
ecf2b77
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lock-free halt flag (Campaign.send_halted_at + send_halt_reason, migration 0049) set by plain UPDATE; sender checks it before every SES call and in the drain loop. Pause = resumable halt, resume re-enqueues remaining PENDING only, stop = permanent CANCELLED with sent rows kept. API POST pause/resume/stop + UI buttons for queued/sending campaigns. Retryable SES throttling requeues remaining PENDING with run_after backoff (bounded, loud) instead of failing the batch.
Acceptance tests: mailing/tests/test_campaign_hard_stop.py (10 tests: zero SES calls after ack, 1-call stop latency, resume no-duplicates, no-lock code proof, API + UI incl. visible errors, throttle requeue + exhaustion). Neighbouring suites green locally (204 passed).