]> git.ipfire.org Git - thirdparty/patchwork.git/commit
parsemail: wrap parse_mail() in a single transaction main
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:12:31 +0000 (13:12 +0100)
commit644cef7cd369abd39eba9523f8ecbc16d2ea4206
tree9f65e7e4a738fa3d076414afa506cfd2128ce3b9
parent3558907533a1a420ccceec6935635e7c2245eb69
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]
patchwork/management/commands/parsemail.py
releasenotes/notes/parsemail-transaction-d4e5f6g7h8i9j0k1.yaml [new file with mode: 0644]