X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=openerp%2Fcron.py;h=d24300b7f430d2d134f71674eeab55bc44cc85f9;hb=4e2d5eba1c9f0d9943233f28dda58a6baa23532a;hp=b1c5819806298fef1a94788ac3c61c1444247dd3;hpb=f2b9b58fd3f788a51fa40a7f01806f51ef2bcee0;p=odoo%2Fodoo.git diff --git a/openerp/cron.py b/openerp/cron.py index b1c5819..d24300b 100644 --- a/openerp/cron.py +++ b/openerp/cron.py @@ -45,6 +45,7 @@ import threading import time import openerp +import tools # Heapq of database wake-ups. Note that 'database wake-up' meaning is in # the context of the cron management. This is not originally about loading @@ -175,9 +176,10 @@ def runner_body(): timestamp, db_name, canceled = task if canceled: continue + del _wakeup_by_db[db_name] registry = openerp.pooler.get_pool(db_name) if not registry._init: - _logger.debug("Database '%s' wake-up! Firing cron jobs in multithreads", db_name) + _logger.debug("Database '%s' wake-up! Firing multi-threaded cron job processing", db_name) registry['ir.cron']._run_jobs_multithread() amount = MAX_SLEEP with _wakeups_lock: @@ -197,6 +199,11 @@ def start_master_thread(): """ global _thread_slots _thread_slots = openerp.conf.max_cron_threads + db_maxconn = tools.config['db_maxconn'] + if _thread_slots >= tools.config.get('db_maxconn', 64): + _logger.warning("Connection pool size (%s) is set lower than max number of cron threads (%s), " + "this may cause trouble if you reach that number of parallel cron tasks.", + db_maxconn, _thread_slots) t = threading.Thread(target=runner, name="openerp.cron.master_thread") t.setDaemon(True) t.start()