[FIX] event: avoid too large prefetching of event.mail

The prefetching engine wants to prefetch all the registrations to all
the events of all the schedulers, which may make a lot of data.

If the autocommit is on, then all this prefetched data is discarded at
each loop.

This commit limits the prefetching to each scheduler, so that we avoid
prefetching the data unnecessarily.

closes odoo/odoo#62052

X-original-commit: 904a46f28cb64e3bd51c40dc364b256d434d1c93
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Signed-off-by: Paul Morelle <madprog@users.noreply.github.com>
This commit is contained in:
Paul Morelle
2020-11-19 20:25:10 +00:00
parent 336192256d
commit 75280cf00e
+2 -1
View File
@@ -169,7 +169,8 @@ You receive this email because you are:
for scheduler in schedulers:
try:
with self.env.cr.savepoint():
scheduler.execute()
# Prevent a mega prefetch of the registration ids of all the events of all the schedulers
self.browse(scheduler.id).execute()
except Exception as e:
_logger.exception(e)
self.invalidate_cache()