feat(mail): send service identity mail through a leased worker

This commit is contained in:
shira committed 2026-10-06 21:08:11 +03:00
1 parent 204c6bae62
commit d21fd49a42
58 files changed
+7577 -164

No files matched your search

@@ -113,6 +113,20 @@ type Delivery struct {
Version int64
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
// The token whose link the body carries; set for verification and password reset mail, NULL for notifications. The worker checks the token before it sends.
EmailTokenID pgtype.UUID
// Why a cancelled delivery was not sent; set exactly when the status is cancelled.
CancelReason pgtype.Text
// Lease owner of the sending worker that claimed the delivery; NULL when no worker holds it.
ClaimOwner pgtype.UUID
// When the lease of claim_owner expires; another worker may claim the delivery after it.
ClaimedUntil pgtype.Timestamptz
// When the first request of this delivery was started, by the database clock; the provider keeps the idempotency key for a window counted from here.
FirstSendStartedAt pgtype.Timestamptz
// Consecutive failures of the sending worker on this row (not provider answers); reset by a recorded attempt.
FailureCount int32
// Set when the bodies of a token mail were cleared after the delivery reached a terminal status, so a database dump holds no live or dead token.
BodyRedactedAt pgtype.Timestamptz
}
type DeliveryAttempt struct {