Skip to content

Record how scheduled email runs went, and retry refused reminders - #146

Open
Darknode-Official wants to merge 1 commit into
mainfrom
fix/cron-health
Open

Darknode-Official wants to merge 1 commit into
mainfrom
fix/cron-health

Conversation

@Darknode-Official

Copy link
Copy Markdown
Owner

Why

The Worker keeps no logs, so nobody can tell whether the daily reminder or the Monday summary ran, failed or had nothing to send. Reminders were also recorded before sending and stayed recorded when the provider refused the batch, so those people never got the email and still counted as "Sent".

What

  • worker/cron-log.js: every scheduled run writes cronRuns/{job} = { at, ok, sent, note }. Jobs switched off on a server (staging) write nothing.
  • Reminder: a 4xx from the provider removes the records so the next run retries. After a timeout or 5xx the records stay, so nobody gets two.
  • Owner page, Reminder email panel: last run of both jobs, with the error if it failed.

No rules change: cronRuns/ has no client rule, so clients are denied.

Verified

  • npm test: 5237 passed, including a refused batch (422), a server error (500) and a switched-off job.
  • Panel checked in the Deck build with sample data, at desktop and 390px.
  • Staging Worker: the owner route refuses unsigned calls and a forged stop link is rejected.

Not verified

  • A real production run; the first one after deploy will show on the Owner page.

The Worker keeps no logs, so a failing cron looked the same as a quiet one. Each run of the
reminder and the Monday summary now writes cronRuns/{job}, and the Owner page shows it.

A reminder batch the email provider refused (4xx) no longer counts as sent: the records are
removed and the next run tries again. After a timeout or 5xx they stay, so nobody gets two.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant