Commit graph parsimony/internal/queue/queue.go
Author SHA1 Message Date
tgiachi
51e2bf683e feat(queue): count sent, failed and dropped deliveries of a post
- a delivery the relay accepted completes as sent, one given up as
  failed, one to a missing mailbox (or with a missing body) is dropped
  through store.DropOutbox; a retry changes nothing
- tests: each outcome of a post, giving up after MaxAge, a missing body,
  and discussion mail sent before a bigger newsletter queued earlier
2026-11-10 12:38:32 +01:00
tgiachi
d9012cc13a perf(queue): purge old failures at most every 5 minutes and read each body once per run
- RunOnce purged failed deliveries (a full scan) on every batch of 50: the Worker now
  does it at most once every 5 minutes, by the store clock; a failed purge is retried
  on the next run.
- Every recipient re-read the whole message from SQLite: a per-run map msgID -> body,
  filled once per message even under concurrency, is dropped when the run ends.
- Tests count purges across batches and after the interval, and body reads per message
  (including a missing body) through unexported hooks.
2026-11-10 11:51:26 +01:00
tgiachi
bb0858ef87 fix: keep refused deliveries visible instead of dropping them silently
- Add failed deliveries: a permanent refusal by the relay (policy, size, line length) or the 3-day give-up marks the delivery failed, with the reason, and never retries it
- Keep failed deliveries listed for a week, then purge them and their stored message
- A non-existent mailbox still drops the delivery and counts a hard bounce
- Migrate the outbox table
2026-11-09 20:33:27 +01:00
tgiachi
aa55cd3c17 feat(queue): optional signing hook applied to the final message 2026-11-09 19:58:47 +01:00
tgiachi
e6713962f9 feat(queue): background worker with retries, backoff and bounded concurrency
- Add Worker.RunOnce, Run and Wake over the durable outbox
- Send prefix plus shared message per recipient with a per-send timeout
- Retry temporary failures after 1m, 5m, 15m, 1h, 3h, then every 6h; give up after 3 days
- Drop permanent failures; count a hard bounce only for bad-mailbox replies
- Leave interrupted sends queued on shutdown
- Share the bounce threshold between router and worker
2026-11-09 15:47:14 +01:00