Skip to content
Snippets Groups Projects
user avatar
Thibault Delavallée authored
This commit adds new methods to add or update followers to documents. Purpose
is to have new optimized methods that perform less queries. It is based on
experience and use cases of various addons in Odoo using it.

Technically two main methods are given on mail.followers model

 * _add_followers: this method generates values required to create new
   followers or update existing one. It takes several parameter controlling
   how to deal with existing followers. This is used notably when auto
   subscription should not erase existing subscriptions;
 * _insert_followers: this method creates or updates followers for a given
   set of documents. It uses result from _add_followers;

Performance gain come from the use of a SQL query to fetch followers data
as well as less use of record sets. Code can be more low-level in some
places. Purpose is to avoid browse and prefetch and just fetch data once
and use it in various computation.

New implementation is equivalent to the old one. It offers more flexibility
as caller can either receive values for followers or directly have records
created and updated. Various parameter allow to tune computation depending
on each specific call to the new follower methods.

Future commits will gradually replace the use of old _add_follower_command
by the new methods. Purpose is to replace them one by one in order to see
the gain in term of performance one replacement at a time.
86bf50db
History
Name Last commit Last update