From d19195de0db735bc134497d9779dfd79983d7277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 31 Jan 2018 10:25:27 +0100 Subject: [PATCH] [DOC] test_mail: update performance counters after last commits Commits improving performance counters related to mailing * introduction of message_log (https://github.com/odoo/odoo/commit/8ddca6f95a52d36c4a8731dcf93413e8206dce81) and its application in the mail_thread (https://github.com/odoo/odoo/commit/99be64dc174af9ad7eb739575215aa03260e833b and https://github.com/odoo/odoo/commit/74ec8a95a0f7b1aadd847a728b4d9bc24daca495). This commit has a big impact on the runbot installation query count (110K on 700K, about 15%); * moving templates from mail.templates to qweb (https://github.com/odoo/odoo/commit/2f7593761c1ea432e2e58045150150356816f868). This merge has an impact on the runbot installation query count (10K on 680K); * removing (un)follow buttons in notification emails (https://github.com/odoo/odoo/commit/11d2d30e91758baaa9c6241a86f97ae3dfe52ad2). This commit has an impact on the runbot installation query count (8K on 690K); * removing 'always' tracking option, meaning less tracking values are created when writing on a record (https://github.com/odoo/odoo/commit/c99de4551583e801ecc6669ac456c4f7e2eef1da). No impact is given as it is mixed with another commit that decreases performances. Commits decreasing performance counters related to mailing * adding the discussion subtype consideration in data send to the bus (https://github.com/odoo/odoo/commit/c99de4551583e801ecc6669ac456c4f7e2eef1da). Future improvements will come that improve bus management in chatter and channels. Apart from those commits there are several commits notably from @rco-odoo that improves performances that are not listed here. --- addons/test_mail/tests/test_performance.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/test_mail/tests/test_performance.py b/addons/test_mail/tests/test_performance.py index c14769b09c1..9505791bd98 100644 --- a/addons/test_mail/tests/test_performance.py +++ b/addons/test_mail/tests/test_performance.py @@ -77,7 +77,7 @@ class TestMailPerformance(TransactionCase): 'partner_id': self.env.ref('base.res_partner_12').id, }) - with self.assertQueryCount(admin=33, demo=45): # test_mail only: 30 - 41 + with self.assertQueryCount(admin=10, demo=10): # test_mail only: 8 - 8 record.track = 'X' @users('admin', 'demo') @@ -93,13 +93,13 @@ class TestMailPerformance(TransactionCase): @warmup def test_create_mail_with_tracking(self): """ Create records inheriting from 'mail.thread' (with field tracking). """ - with self.assertQueryCount(admin=64, demo=86): # test_mail only: 58 - 78 + with self.assertQueryCount(admin=22, demo=22): # test_mail only: 18 - 18 self.env['test_performance.mail'].create({'name': 'X'}) @users('admin', 'emp') @warmup def test_create_mail_simple(self): - with self.assertQueryCount(admin=33, emp=43): # test_mail only: 30 - 39 + with self.assertQueryCount(admin=12, emp=12): # test_mail only: 10 - 10 self.env['mail.test.simple'].create({'name': 'Test'}) @users('admin', 'emp') @@ -137,7 +137,7 @@ class TestAdvMailPerformance(TransactionCase): def test_adv_activity(self): model = self.env['mail.test.activity'] - with self.assertQueryCount(admin=36, emp=46): # test_mail only: 33 - 42 + with self.assertQueryCount(admin=15, emp=15): # test_mail only: 13 - 13 model.create({'name': 'Test'}) @users('admin', 'emp') @@ -149,7 +149,7 @@ class TestAdvMailPerformance(TransactionCase): 'default_res_model': 'mail.test.activity', }) - with self.assertQueryCount(admin=47, emp=53): # com runbot 46 - 51 // test_mail only: 35 - 40 + with self.assertQueryCount(admin=47, emp=53): # com runbot 46 - 52 // test_mail only: 35 - 41 model.create({ 'summary': 'Test Activity', 'res_id': record.id, @@ -243,7 +243,7 @@ class TestHeavyMailPerformance(TransactionCase): self.umbrella.message_subscribe(self.user_portal.partner_id.ids) record = self.umbrella.sudo(self.env.user) - with self.assertQueryCount(admin=123, emp=156): # com runbot 121 - 154 // test_mail only: 117 - 149 + with self.assertQueryCount(admin=124, emp=157): # com runbot 122 - 155 // test_mail only: 118 - 150 record.message_post( body='

Test Post Performances

', message_type='comment', @@ -260,7 +260,7 @@ class TestHeavyMailPerformance(TransactionCase): record = self.umbrella.sudo(self.env.user) template_id = self.env.ref('test_mail.mail_test_tpl').id - with self.assertQueryCount(admin=148, emp=196): # com runbot 146 - 194 // test_mail only: 140 - 186 + with self.assertQueryCount(admin=149, emp=197): # com runbot 147 - 195 // test_mail only: 141 - 187 record.message_post_with_template(template_id, message_type='comment', composition_mode='comment') self.assertEqual(record.message_ids[0].body, '

Adding stuff on %s

' % record.name) @@ -276,7 +276,7 @@ class TestHeavyMailPerformance(TransactionCase): customer_id = self.customer.id user_id = self.user_portal.id - with self.assertQueryCount(admin=348, emp=421): # test_mail only: 330 - 399 + with self.assertQueryCount(admin=325, emp=388): # test_mail only: 308 - 368 rec = self.env['mail.test.full'].create({ 'name': 'Test', 'umbrella_id': umbrella_id, @@ -315,7 +315,7 @@ class TestHeavyMailPerformance(TransactionCase): }) self.assertEqual(rec.message_partner_ids, self.user_portal.partner_id | self.env.user.partner_id) - with self.assertQueryCount(admin=239, emp=279): # test_mail only: 232 - 271 + with self.assertQueryCount(admin=239, emp=279): # test_mail only: 233 - 271 rec.write({ 'name': 'Test2', 'umbrella_id': umbrella_id,