[PATCH 4/5] parser: don't trigger database IntegrityErrors on duplicate comments

2020-04-15 Thread Jeremy Kerr
As we've done for the Patch model, this change prevents database errors from duplicate Comments. Signed-off-by: Jeremy Kerr --- patchwork/parser.py| 6 +++--- patchwork/tests/test_parser.py | 12 2 files changed, 15 insertions(+), 3 deletions(-) diff --git

[PATCH 1/5] tests: Add duplicate mail test

2020-04-15 Thread Jeremy Kerr
Test that we get the correct DuplicateMailError from parsing the same mail twice. Signed-off-by: Jeremy Kerr --- patchwork/tests/test_parser.py | 27 +++ 1 file changed, 27 insertions(+) diff --git a/patchwork/tests/test_parser.py b/patchwork/tests/test_parser.py index

[PATCH 2/5] tests: ensure we don't see database errors during duplicate insert

2020-04-15 Thread Jeremy Kerr
Currently, the parser causes IntegrityErrors while inserting duplicate patches; these tend to pollute database logs. This change adds a check, which currently fails, to ensure we do not cause errors during a duplicate patch parse. Signed-off-by: Jeremy Kerr --- patchwork/tests/test_parser.py |

[PATCH 3/5] parser: prevent IntegrityErrors

2020-04-15 Thread Jeremy Kerr
Currently, the parser relies on causing (and catching) IntegrityErrors on patch insert to catch duplicate (msgid,project) mails. This change performs an atomic select -> insert instead. Signed-off-by: Jeremy Kerr --- patchwork/parser.py | 7 --- 1 file changed, 4 insertions(+), 3

[PATCH 0/5] Prevent database error logs on duplicate mail

2020-04-15 Thread Jeremy Kerr
On patchwork.ozlabs.org, we see a lot of noise in the postgres logs, due to INSERTs with duplicate values for (project,msgid) keys. Patchwork's strategy for catching the resulting IntegrityError means that each of these is logged. Instead, this change moves to an atomic select -> insert for the

[PATCH 5/5] parser: don't trigger database IntegrityErrors on duplicate coverletters

2020-04-15 Thread Jeremy Kerr
As we've done for the Patch and Comment models, this change prevents database errors from duplicate CoverLetters. Signed-off-by: Jeremy Kerr --- patchwork/parser.py| 7 --- patchwork/tests/test_parser.py | 10 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff

[PATCH] parser: Don't crash when From: is list email but has weird mangle format

2020-04-15 Thread Andrew Donnellan
get_original_sender() tries to demangle DMARC-mangled From headers, in the case where the email's From address is the list address. It knows how to handle Google Groups and Mailman style mangling, where the original submitter's name will be turned into e.g. "Andrew Donnellan via linuxppc-dev". If