]> git.ipfire.org Git - thirdparty/patchwork.git/commit
parsemail: wrap parse_mail() in a single transaction stable/3.2
authorRobin Jarry <robin@jarry.cc>
Mon, 8 Jun 2026 11:59:43 +0000 (13:59 +0200)
committerStephen Finucane <stephen@that.guru>
Wed, 10 Jun 2026 12:44:57 +0000 (13:44 +0100)
commit0ea35f855101a367195e8407f0a085c5be861ed6
treefa7d998e22bb8923fdf6289fdca601cff21b30ee
parent481adeb0606f3867de71755c39d0ee10f1d264bb
parsemail: wrap parse_mail() in a single transaction

Wrap the entire parse_mail() call in transaction.atomic() so that all
database writes from email parsing run inside a single transaction.
The existing transaction.atomic() blocks inside parse_mail() become
savepoints within this outer transaction. The series deduplication
retry logic continues to work since savepoint rollbacks are scoped
to their own savepoint.

This also ensures that any on_commit() callbacks registered by signal
handlers only fire after the full email has been parsed and all
patch/series associations are committed.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Signed-off-by: Stephen Finucane <stephen@that.guru>
Reviewed-by: Stephen Finucane <stephen@that.guru>
[stephenfin: Slight tweaks to the release notes]
(cherry picked from commit 644cef7cd369abd39eba9523f8ecbc16d2ea4206)
patchwork/management/commands/parsemail.py
releasenotes/notes/parsemail-transaction-d4e5f6g7h8i9j0k1.yaml [new file with mode: 0644]