-
- Downloads
[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.
Showing
- addons/account/tests/test_account_customer_invoice.py 1 addition, 0 deletionsaddons/account/tests/test_account_customer_invoice.py
- addons/hr_holidays/tests/test_holidays_flow.py 1 addition, 0 deletionsaddons/hr_holidays/tests/test_holidays_flow.py
- addons/mail/models/mail_followers.py 2 additions, 1 deletionaddons/mail/models/mail_followers.py
- addons/mail/models/mail_thread.py 0 additions, 1 deletionaddons/mail/models/mail_thread.py
- addons/test_mail/tests/test_mail_activity.py 1 addition, 0 deletionsaddons/test_mail/tests/test_mail_activity.py
- addons/test_mail/tests/test_performance.py 12 additions, 12 deletionsaddons/test_mail/tests/test_performance.py
Loading
Please register or sign in to comment