_logger = logging.getLogger(__name__)
-# Scheduling wake-ups (see below) can be disabled when the polling process
-# workers are used instead of the managed thread workers. (I.e. wake-ups are
-# not used since polling is used. And polling is used when the cron are
-# handled by running special processes, e.g. openerp-cron-worker, instead
-# of the general openerp-server script.)
-enable_schedule_wakeup = True
-
# 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
# a database, although having the database name in the queue will
_wakeups = []
_wakeup_by_db = {}
+
def schedule_wakeup(timestamp, db_name):
""" Schedule a new wake-up for a database.
:param timestamp: when the wake-up is scheduled.
"""
- global enable_schedule_wakeup
- if not enable_schedule_wakeup:
- return
if not timestamp:
return
with _wakeups_lock:
_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)
- if _thread_slots:
- t = threading.Thread(target=runner, name="openerp.cron.master_thread")
- t.setDaemon(True)
- t.start()
- _logger.debug("Master cron daemon started!")
- else:
- _logger.info("No master cron daemon (0 workers needed).")
+ t = threading.Thread(target=runner, name="openerp.cron.master_thread")
+ t.setDaemon(True)
+ t.start()
+ _logger.debug("Master cron daemon started!")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: