ir.cron performances: check "doall" parameter earlier
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Fix Committed
|
Medium
|
OpenERP Publisher's Warranty Team |
Bug Description
Let's say you have defined the following cron job in OpenERP 6.0:
<record id="ir_
<field eval="&
<field eval="&
<field name="user_id" ref="base.
<field eval="&
<field eval="-1" name="numbercall"/>
<field eval="&
<field eval="5" name="priority"/>
<field eval="0" name="doall"/>
<field eval="1" name="active"/>
<field eval="10" name="interval_
<field eval="&
<field eval="([], {'invoicing_cron': True})" name="args"/>
</record>
As you can see it's a job running every 10 minutes. Its next call is defined to a really ancient date (1900-01-01) to make sure it will run.
When installing the module in which this cron job is defined, the OpenERP server will slow down and consume a lot of resources for several minutes.
This phenomenon is caused by the "while" loop in /bin/addons/
I did not expect this to be an issue because I set the "doall" parameter to False. By doing so, I authorize the cron job to jump in time to now, ignoring intermediate calls.
To fix this, we can refactor the cron loop a little and check the "doall" parameter earlier, saving some iterations.
Related branches
- Naresh(OpenERP): Pending requested
-
Diff: 29 lines (+10/-8)1 file modifiedbin/addons/base/ir/ir_cron.py (+10/-8)
Changed in openobject-server: | |
assignee: | nobody → OpenERP Publisher's Warranty Team (openerp-opw) |
tags: | added: maintenance |
Changed in openobject-server: | |
status: | Confirmed → In Progress |
BTW, I have an OPW partner contract for my customer. Can I leverage it to fix this issue ?