[IMP] core: --db_maxconn_gevent
The Gevent worker has specifc needs in term of maximum concurrent connections to the database and those needs are not compatible with the default limit that is primerly set for http workers. This PR makes it possible to supply a configuration dedicated to the gevent worker. task-id-3193565 task-id-2146565 closes odoo/odoo#125190 Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
This commit is contained in:
+5
-1
@@ -26,6 +26,7 @@ from psycopg2.pool import PoolError
|
||||
from psycopg2.sql import SQL, Identifier
|
||||
from werkzeug import urls
|
||||
|
||||
import odoo
|
||||
from . import tools
|
||||
from .tools.func import frame_codeinfo, locked
|
||||
|
||||
@@ -764,7 +765,10 @@ _Pool = None
|
||||
def db_connect(to, allow_uri=False):
|
||||
global _Pool
|
||||
if _Pool is None:
|
||||
_Pool = ConnectionPool(int(tools.config['db_maxconn']))
|
||||
_Pool = ConnectionPool(int(
|
||||
odoo.evented and tools.config['db_maxconn_gevent']
|
||||
or tools.config['db_maxconn']
|
||||
))
|
||||
|
||||
db, info = connection_info_for(to)
|
||||
if not allow_uri and db != to:
|
||||
|
||||
@@ -259,6 +259,8 @@ class configmanager(object):
|
||||
help="specify the database ssl connection mode (see PostgreSQL documentation)")
|
||||
group.add_option("--db_maxconn", dest="db_maxconn", type='int', my_default=64,
|
||||
help="specify the maximum number of physical connections to PostgreSQL")
|
||||
group.add_option("--db_maxconn_gevent", dest="db_maxconn_gevent", type='int', my_default=False,
|
||||
help="specify the maximum number of physical connections to PostgreSQL specifically for the gevent worker")
|
||||
group.add_option("--db-template", dest="db_template", my_default="template0",
|
||||
help="specify a custom database template to create a new database")
|
||||
parser.add_option_group(group)
|
||||
@@ -448,7 +450,7 @@ class configmanager(object):
|
||||
'db_port', 'db_template', 'logfile', 'pidfile', 'smtp_port',
|
||||
'email_from', 'smtp_server', 'smtp_user', 'smtp_password', 'from_filter',
|
||||
'smtp_ssl_certificate_filename', 'smtp_ssl_private_key_filename',
|
||||
'db_maxconn', 'import_partial', 'addons_path', 'upgrade_path',
|
||||
'db_maxconn', 'db_maxconn_gevent', 'import_partial', 'addons_path', 'upgrade_path',
|
||||
'syslog', 'without_demo', 'screencasts', 'screenshots',
|
||||
'dbfilter', 'log_level', 'log_db',
|
||||
'log_db_level', 'geoip_city_db', 'geoip_country_db', 'dev_mode',
|
||||
|
||||
Reference in New Issue
Block a user