feat(notification): add durable mail delivery state

This commit is contained in:
shira committed 2026-10-06 10:52:47 +03:00
1 parent 391c8a6cec
commit 2db585fbff
41 files changed
+4903 -108

No files matched your search

+5 -4
View File
@@ -59,7 +59,7 @@ var (
// therefore calls InvalidateActive before UpdateRegistration or Insert; the
// opposite order can deadlock against a concurrent confirmation. The only
// exception is DeleteUnverifiedRegisteredBefore, which locks the account
// before its tokens and sessions; it is safe because every lock it takes uses
// before its tokens, sessions, and deliveries; it is safe because every lock it takes uses
// SKIP LOCKED and never waits. A deadlock that still happens, for example
// between callers that ignore this order, aborts one transaction with
// ErrTransactionConflict, and the caller may retry it.
@@ -99,9 +99,10 @@ type UserRepository interface {
// DeleteUnverifiedRegisteredBefore deletes at most limit accounts that are
// unverified and were last registered before cutoff, oldest first, with
// their tokens and sessions, and returns how many it deleted. It never
// waits for a lock: an account whose row, token, or session is locked by
// another transaction is skipped and stays for the next run. A cleanup job
// their tokens, sessions, and mail deliveries, and returns how many it
// deleted. It never waits for a lock: an account whose row, token,
// session, or delivery is locked by another transaction is skipped and
// stays for the next run. A cleanup job
// repeats it until the result is below limit and runs again later.
DeleteUnverifiedRegisteredBefore(ctx context.Context, cutoff time.Time, limit int32) (int64, error)
}