From df30d4d7c4ef4abfac4aac48764c1a5a1ee00ffe Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Fri, 29 Apr 2022 09:59:07 +0000 Subject: [PATCH] [FIX] mail: process first 100 mail failures only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Processing failed mails is quite consuming operation that leads to browser slowness or even crash. It's especially painful, because user doesn't see the reason for it. Bypass the problem by processing first 100 notifications only. --- opw-2810681 opw-2754243 task-2806549 closes odoo/odoo#90246 X-original-commit: ec2d3550f32ae1e0585630b5b38befb73ddf2b26 Signed-off-by: Sébastien Theys (seb) Signed-off-by: Ivan Elizaryev (iel) --- addons/mail/models/res_partner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/models/res_partner.py b/addons/mail/models/res_partner.py index 1a79438d033..39ebe2f17bd 100644 --- a/addons/mail/models/res_partner.py +++ b/addons/mail/models/res_partner.py @@ -125,7 +125,7 @@ class Partner(models.Model): return partners_format def _message_fetch_failed(self): - """Returns all messages, sent by the current partner, that have errors, in + """Returns first 100 messages, sent by the current partner, that have errors, in the format expected by the web client.""" self.ensure_one() notifications = self.env['mail.notification'].search([ @@ -134,7 +134,7 @@ class Partner(models.Model): ('mail_message_id.message_type', '!=', 'user_notification'), ('mail_message_id.model', '!=', False), ('mail_message_id.res_id', '!=', 0), - ]) + ], limit=100) return notifications.mail_message_id._message_notification_format() def _get_channels_as_member(self):