Message ID | 20180224145020.15181-8-dja@axtens.net |
---|---|
State | Accepted |
Headers | show |
Series | Tools and fixes for parallel parsing | expand |
Context | Check | Description |
---|---|---|
dja/snowpatch-0_1_0 | success | master/apply_patch Successfully applied |
dja/snowpatch-snowpatch_job_snowpatch-patchwork | success | Test snowpatch/job/snowpatch-patchwork on branch master |
On Sun, 2018-02-25 at 01:50 +1100, Daniel Axtens wrote: > Analysis of SQL statements showed that when parsing an email, the row > for the Person who sent the email was always getting updated. This is > because the test for updating it only checks if the incoming mail has > *a* name attached to the email address, and not if it has a new name. > Django is not smart enough to figure that out, and so unconditionally > UPDATEs the model when asked to save. > > Give it a hand - only update the model and save it if the new name is > in fact different. Reviewed-by: Stephen Finucane <stephen@that.guru>
diff --git a/patchwork/parser.py b/patchwork/parser.py index 885c20b3df4f..9502162be90c 100644 --- a/patchwork/parser.py +++ b/patchwork/parser.py @@ -349,7 +349,7 @@ def get_or_create_author(mail): defaults={'name': name, 'email': email})[0] - if name: # use the latest provided name + if name and name != person.name: # use the latest provided name person.name = name person.save()