openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #14674
[Bug 1039600] [NEW] ir.cron performances: check "doall" parameter earlier
Public bug reported:
Let's say you have defined the following cron job in OpenERP 6.0:
<record id="ir_cron_collect_invoicing_candidates" model="ir.cron">
<field eval=""""collect_and_generate_invoices"""" name="function"/>
<field eval=""""minutes"""" name="interval_type"/>
<field name="user_id" ref="base.user_root"/>
<field eval=""""Collect invoiceable projects and generate their invoices"""" name="name"/>
<field eval="-1" name="numbercall"/>
<field eval=""""1900-01-01 00:00:00"""" name="nextcall"/>
<field eval="5" name="priority"/>
<field eval="0" name="doall"/>
<field eval="1" name="active"/>
<field eval="10" name="interval_number"/>
<field eval=""""project.project"""" name="model"/>
<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/base/ir/ir_cron.py (see:
http://bazaar.launchpad.net/~openerp/openobject-
server/6.0/view/head:/bin/addons/base/ir/ir_cron.py#L115 ). This loop
will advance from 1900-01-01 to now by 10 minutes increments.
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.
** Affects: openobject-server
Importance: Undecided
Status: New
** Tags: cron cronjob ir.cron server
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1039600
Title:
ir.cron performances: check "doall" parameter earlier
Status in OpenERP Server:
New
Bug description:
Let's say you have defined the following cron job in OpenERP 6.0:
<record id="ir_cron_collect_invoicing_candidates" model="ir.cron">
<field eval=""""collect_and_generate_invoices"""" name="function"/>
<field eval=""""minutes"""" name="interval_type"/>
<field name="user_id" ref="base.user_root"/>
<field eval=""""Collect invoiceable projects and generate their invoices"""" name="name"/>
<field eval="-1" name="numbercall"/>
<field eval=""""1900-01-01 00:00:00"""" name="nextcall"/>
<field eval="5" name="priority"/>
<field eval="0" name="doall"/>
<field eval="1" name="active"/>
<field eval="10" name="interval_number"/>
<field eval=""""project.project"""" name="model"/>
<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/base/ir/ir_cron.py (see:
http://bazaar.launchpad.net/~openerp/openobject-
server/6.0/view/head:/bin/addons/base/ir/ir_cron.py#L115 ). This loop
will advance from 1900-01-01 to now by 10 minutes increments.
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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1039600/+subscriptions
Follow ups
References