Repository navigation
[FIX] mail_ux: read only the last message in channel_fetched - #518
Open
fw-bot-adhoc wants to merge 1 commit into
Open
fw-bot-adhoc wants to merge 1 commit into
fw-bot-adhoc wants to merge 1 commit into
Conversation
stdout: Auto-merging mail_ux/tests/__init__.py CONFLICT (content): Merge conflict in mail_ux/tests/__init__.py stderr:
Contributor
Contributor
Author
|
@az-adhoc @maq-adhoc cherrypicking of pull request #501 failed. stdout: Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?).
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Cada mensaje nuevo en un chat de Discuss hace que Odoo 18 lea todos los mensajes de ese chat, una vez por cada pestaña abierta de cada participante, solo para saber cuál es el último. En chats de muchos años (decenas de miles de mensajes) eso pasa a ser lo que más SQL consume en la base y la frena. Este PR hace que lea solo el último mensaje.
Tarea: https://www.adhoc.inc/odoo/project.task/79479
Qué pasa en upstream
discuss.channel.channel_fetchedcada vez que llega un mensaje nuevo por el bus a un canal que no es de tipochannel(mail/static/src/discuss/core/common/discuss_core_common_service.js). Lo llama cada pestaña de cada miembro.channel_fetchedhacechannel.message_ids.ids[0]: resuelve el one2many entero, con el chequeo de acceso demail.message._search, para quedarse con el primer id.channel_type in {chat, whatsapp}está después de esa carga, así que en los grupos también lee todo el canal y después lo descarta.masterOdoo sacóchannel_fetchedy el campofetched_message_id. En 18.0 y 19.0 sigue igual.Qué cambia
Override de
channel_fetchedenmail_ux:channel_typeantes de buscar nada;message_ids(model,res_id,message_type != user_notification),order="id desc"ylimit=1, como el usuario actual. Es lo mismo que hacemastercon_search(..., order="id desc", limit=1).El resto del método (búsqueda del miembro,
UPDATE ... SKIP LOCKEDy la notificación por bus) queda igual que upstream.Medición
En la base más afectada de la flota,
channel_fetchedera el 54,6% del tiempo SQL de un día hábil: 8.151 llamadas a 602 ms, y la consulta devolvía en promedio 15.256 filas por llamada. En la flota productiva de 18 y 19, 102 bases llamaron achannel_fetchedese día y en 77 cuesta menos de 50 ms por llamada.Pruebas
test_chat_fetched_reads_only_last_message: en un chat con varios mensajes y unuser_notificational final,fetched_message_idqueda en el último mensaje visible ymail.message._searchse llama una sola vez, conlimit=1. Con el código de upstream falla, porquemessage_idsbusca sin límite.test_group_fetched_is_skipped: en un grupo no se busca ningún mensaje.channel_fetcheden el log de acceso tiene que bajar a pocos ms, sin depender del tamaño del chat.Después del merge sale el forward-port a 19.0, donde el método es igual.
Forward-Port-Of: #503
Forward-Port-Of: #501