Skip to content

Commit

Permalink
[IMP] runbot: ir.cron frequency from 0.016 Hz to 0.1 Hz
Browse files Browse the repository at this point in the history
Monkey patch ir.cron to increase frequency to 0.1 Hz.

In a setup with 6 workers every worker should have the lock every minute.
  • Loading branch information
Odoo Online committed Sep 8, 2015
1 parent e02e7e5 commit 02a96a2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions runbot/runbot.py
Expand Up @@ -20,6 +20,7 @@
from collections import OrderedDict

import dateutil.parser
from dateutil.relativedelta import relativedelta
import requests
from matplotlib.font_manager import FontProperties
from matplotlib.textpath import TextToPath
Expand All @@ -43,8 +44,10 @@
_re_warning = r'^\d{4}-\d\d-\d\d \d\d:\d\d:\d\d,\d{3} \d+ WARNING '
_re_job = re.compile('job_\d')

# monkey patch cron system to reduce starvation and improve throughput with many workers
openerp.service.server.SLEEP_INTERVAL = 4
# increase cron frequency from 0.016 Hz to 0.1 Hz to reduce starvation and improve throughput with many workers
# TODO: find a nicer way than monkey patch to accomplish this
openerp.service.server.SLEEP_INTERVAL = 10
openerp.addons.base.ir.ir_cron._intervalTypes['minutes'] = lambda interval: relativedelta(seconds=interval*10)

#----------------------------------------------------------
# RunBot helpers
Expand Down

0 comments on commit 02a96a2

Please sign in to comment.