Files
odoo_source/addons/google_calendar/data/google_calendar_data.xml
T
sndandNicolas Martinelli f7eb653e7a [FIX] google_calendar: synchronization cron timeout
In a database with many users / events to synchronize, the cron
`ir_cron_sync_all_cals` may time out. Consequently, even if a `commit`
is performed for each user, some users are never synchronized.

In this commit, we first sort the users by last synchronization date,
meaning that all users will ultimately be synchronized, even if the cron
times out. On top of that, we introduce the context key
`last_sync_hours` to prevent the synchronization in case the cron is
restarted after timeout.

opw-2158372

closes odoo/odoo#45032

X-original-commit: 2f21def63c61324e2286dbee6abead091171a041
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Co-authored-by: Nicolas Martinelli <nim@odoo.com>
2020-02-10 17:38:28 +00:00

23 lines
1.1 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record forcecreate="True" id="ir_cron_sync_all_cals" model="ir.cron">
<field name="name">Google Calendar: synchronization</field>
<field name="model_id" ref="model_google_calendar"/>
<field name="state">code</field>
<field name="code">
# The context key 'last_sync_hours' allows specifying the minimum delay between consecutive syncs.
# Indeed, in case there are many users / events to sync, the cron might time out. In this case, the
# solution is to force the last_sync_hours to the expected synchronization interval expected. This
# will avoid the synchronization of users that succeeded in the previous failing cron.
model.synchronize_events_cron()
</field>
<field name="user_id" ref="base.user_root" />
<field name="interval_number">12</field>
<field name="interval_type">hours</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall" />
</record>
</data>
</odoo>