Send admin emails via a background job with live status reporting #462
Labels
No labels
Kestra
bug
enhancement
someday
subtask
☁️ api
🎛️ infrastructure
🐞 sentry
📆 2025 Season
📝 pages
allpicks
📝 pages
picks
📝 pages
standings
🚀 performance
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
johnsturgeon/tgfp-web#462
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
The admin compose-email page (#445, PR #461) sends synchronously inside the POST
handler: it loops the selected players,
awaits a full SMTP round trip each, andonly then renders the bounce page. At pool size (~30) that is a few seconds, but
it holds the request open and is prone to gateway/worker timeouts as the list
grows. The bounce page's delivery lights are rendered once from the finished
results, so there is nothing live about them.
What we want
Move the fan-out off the request and onto a background job, with the same
job-reporting the rest of the app already has, and push per-recipient send
status to the page as it happens.
Sending
app/jobs/scheduler.py,SQLAlchemyJobStore) rather than looping insend_admin_email.custom_email_bodyso the sent message matches the preview.Job reporting
JobState/last_success_at/last_error), so a failed batch is visible on theadmin schedule page alongside everything else.
read it back -- a small status row per send, keyed by a batch id.
Live status on the landing page
same as the current bounce page, but the lights start neutral and flip to
green/red as the job reports each send.
stop polling once every recipient is terminal.
the note in PR #461: live lights only earn their keep once sending is
backgrounded.
Out of scope
Part of #460.