refactor(mail): one send path for Sent, a fixed lock order, and concurrency tests
- the webmail's Send no longer files its own Sent copy: it asks Submit to (FileSentCopy), the same path SMTP clients use, so the rule exists once - every operation now locks the folders first (lowest id first) and the message after. Opposite moves, and a move racing a flag change, deadlocked (SQLSTATE 40P01) because they took those locks in different orders; the new test reproduces it (10-19 s of retries, errors) and passes in ~1 s with the order - TestOneMailboxEverywhere drives SMTP, IMAP and the webmail on one mailbox, mixing them, and checks after each step that every view agrees with the others and with the rows. It fails on the previous code and passes now.
This commit is contained in:
1 parent
67bbe7a50a
commit
183191d18d
6 files changed
+612
-48
No files matched your search
@@ -197,6 +197,8 @@ func newSendableUseCaseWith(
|
||||
}
|
||||
submission := NewProcessOutboundEmailUseCase(
|
||||
nil, &countingOutboundRepo{}, &capturingBlobStorage{}, &recordingSigner{})
|
||||
// The Sent copy is filed by the submission, as it is for SMTP clients
|
||||
submission.SetSentCopies(messages)
|
||||
return (&WebmailUseCase{
|
||||
repo: repo,
|
||||
auth: &stubAuthRepo{account: account},
|
||||
|
||||
Reference in new issue
Block a user