[IMP] Added configuration option for gevent
bzr revid: nicolas.vanhoren@openerp.com-20121122145309-bim6m10p0q7rf6wj
This commit is contained in:
parent
468652ccf7
commit
7137bb0b53
|
@ -224,15 +224,19 @@ def main():
|
|||
check_root_user()
|
||||
openerp.tools.config.parse_config(sys.argv[1:])
|
||||
|
||||
# TODO GEVENT if event
|
||||
import gevent.monkey
|
||||
gevent.monkey.patch_all()
|
||||
import gevent_psycopg2
|
||||
gevent_psycopg2.monkey_patch()
|
||||
if openerp.tools.config.options["gevent"]:
|
||||
_logger.info('Using gevent mode')
|
||||
import gevent.monkey
|
||||
gevent.monkey.patch_all()
|
||||
import gevent_psycopg2
|
||||
gevent_psycopg2.monkey_patch()
|
||||
|
||||
check_postgres_user()
|
||||
openerp.netsvc.init_logger()
|
||||
report_configuration()
|
||||
|
||||
if openerp.tools.config.options["gevent"]:
|
||||
_logger.info('Using gevent mode')
|
||||
|
||||
config = openerp.tools.config
|
||||
|
||||
|
|
|
@ -82,9 +82,9 @@ def start_services():
|
|||
# Initialize the HTTP stack.
|
||||
netrpc_server.init_servers()
|
||||
|
||||
if openerp.conf.max_cron_threads:
|
||||
#openerp.cron.start_master_thread()
|
||||
pass
|
||||
if not openerp.tools.config.options["gevent"]:
|
||||
if openerp.conf.max_cron_threads:
|
||||
openerp.cron.start_master_thread()
|
||||
|
||||
# Start the top-level servers threads (normally HTTP, HTTPS, and NETRPC).
|
||||
openerp.netsvc.Server.startAll()
|
||||
|
|
|
@ -424,10 +424,11 @@ def serve():
|
|||
# TODO Change the xmlrpc_* options to http_*
|
||||
interface = config['xmlrpc_interface'] or '0.0.0.0'
|
||||
port = config['xmlrpc_port']
|
||||
#httpd = werkzeug.serving.make_server(interface, port, application, threaded=True)
|
||||
# TODO GEVENT if event
|
||||
from gevent.wsgi import WSGIServer
|
||||
httpd = WSGIServer((interface, port), application)
|
||||
if not openerp.tools.config.options["gevent"]:
|
||||
httpd = werkzeug.serving.make_server(interface, port, application, threaded=True)
|
||||
else:
|
||||
from gevent.wsgi import WSGIServer
|
||||
httpd = WSGIServer((interface, port), application)
|
||||
_logger.info('HTTP service (werkzeug) running on %s:%s', interface, port)
|
||||
httpd.serve_forever()
|
||||
|
||||
|
|
|
@ -106,6 +106,7 @@ class configmanager(object):
|
|||
help="specify additional addons paths (separated by commas).",
|
||||
action="callback", callback=self._check_addons_path, nargs=1, type="string")
|
||||
group.add_option("--load", dest="server_wide_modules", help="Comma-separated list of server-wide modules default=web")
|
||||
group.add_option("--gevent", dest="gevent", action="store_true", my_default=False, help="Activate the GEvent mode, this also desactivate the cron.")
|
||||
parser.add_option_group(group)
|
||||
|
||||
# XML-RPC / HTTP
|
||||
|
@ -380,7 +381,7 @@ class configmanager(object):
|
|||
'netrpc', 'xmlrpc', 'syslog', 'without_demo', 'timezone',
|
||||
'xmlrpcs_interface', 'xmlrpcs_port', 'xmlrpcs',
|
||||
'static_http_enable', 'static_http_document_root', 'static_http_url_prefix',
|
||||
'secure_cert_file', 'secure_pkey_file', 'dbfilter', 'log_handler', 'log_level'
|
||||
'secure_cert_file', 'secure_pkey_file', 'dbfilter', 'log_handler', 'log_level', 'gevent'
|
||||
]
|
||||
|
||||
for arg in keys:
|
||||
|
|
Loading…
Reference in New Issue