Commit graph parsimony/internal/queue/queue_test.go
Author SHA1 Message Date
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
c1c8211c1b fix(outbound): count a missing mailbox only when RCPT TO says so
- Issue MAIL, RCPT and DATA one by one so a failure knows which command it answers
- Treat 5.1.1, 5.1.2, 5.1.3, 5.1.6 and 5.1.10 as 'no such mailbox' only in answer to RCPT TO
- A refused sender (5.1.x answering MAIL FROM) or a refusal after DATA keeps the delivery as failed and never strikes members
- Ignore a QUIT error once the relay accepted the message: it caused duplicate deliveries
2026-11-10 11:37:45 +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
6461e77a95 feat: document the queue, close mutation gaps, plain relay errors
- Document delivery semantics, retries and the queue API in the README and OpenAPI
- Add relay.concurrency to the example config
- Test that a relay problem never counts against a member, that the longest-waiting delivery goes first, and the error and limit details
- Show the plain relay error when there is a single batch
2026-11-09 16:04:45 +01:00
tgiachi
b207312cef test(queue): do not depend on the order of concurrent sends 2026-11-09 15:47:46 +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