From 006159c38b1313833bd4d2c959b5e80c8598a933 Mon Sep 17 00:00:00 2001 From: Vo Minh Thu Date: Wed, 28 Mar 2012 15:13:12 +0200 Subject: [PATCH] [IMP] cron: added comments. bzr revid: vmt@openerp.com-20120328131312-520xm4f4hd3q887e --- openerp/addons/base/ir/ir_cron.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/openerp/addons/base/ir/ir_cron.py b/openerp/addons/base/ir/ir_cron.py index 0147e6b0bdc..357debb919c 100644 --- a/openerp/addons/base/ir/ir_cron.py +++ b/openerp/addons/base/ir/ir_cron.py @@ -186,9 +186,11 @@ class ir_cron(osv.osv): """ Try to process one cron job. This selects in database all the jobs that should be processed. It then - tries to lock each of them and, if it succeeds, run - the cron job (if it doesn't succeed, it means the job was already - locked to be taken care of by another thread) and stop. + tries to lock each of them and, if it succeeds, run the cron job (if it + doesn't succeed, it means the job was already locked to be taken care + of by another thread) and return. + + If a job was processed, returns True, otherwise returns False. """ db = openerp.sql_db.db_connect(db_name) cr = db.cursor() @@ -239,6 +241,10 @@ class ir_cron(osv.osv): @classmethod def _run(cls, db_names): + """ + Class method intended to be run in a dedicated process to handle jobs. + This polls the database for jobs that can be run every 60 seconds. + """ global quit_signal_received while not quit_signal_received: t1 = time.time()