Skip to content
Snippets Groups Projects
Commit bcc68847 authored by Thibault Delavallée's avatar Thibault Delavallée
Browse files

[IMP] mail: limit cache invalidation when subscribing followers

Cache invalidation when subscribing people has been added at e6f038a8.
Indeed subscribing partners to a record may lead to an access right update
as some of them are based on followers. This is why a cache invalidation
is necessary to avoid access rights issues.

However subscribing people to a record should change their rights only on
the records involved in the subscription mechanism. We can therefore give
ids to the cache invalidation to limit to updated records.

Cache invalidation is also limited when writing on followers if writing
on model, res_id or partner_id fields. Indeed changing subtypes or
channel of a subscription should have no impact on cache and access rights.

Cache invalidation done manually in _message_subscribe is not necessary
as subscription create or update mail.followers records since f9c21092.
Create and write of mail.followers records already ask for cache invalidation.
It is therefore not necessary to invalidate cache twice.

This commit allows to save a few queries on some tests, notably about
activities that deal with subscription and messages. As cache is now kept
it is not necessary to refetch some data, leading to a few query gain. We
gain about 1K queries on com runbot.

A side effect of limiting cache invalidation is that some unit tests require
a manual cache invalidation to have up to date results. Indeed record not
being up to date in cache was hidden by the invalidation we just removed.
parent 26d110c4
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment