diff --git a/web/config.py b/web/config.py index e6b54f0d7..9e72bfb44 100644 --- a/web/config.py +++ b/web/config.py @@ -22,6 +22,13 @@ root = os.path.dirname(os.path.realpath(__file__)) if sys.path[0] != root: sys.path.insert(0, root) +# The config database connection pool size. +# Setting this to 0 will remove any limit. +CONFIG_DATABASE_CONNECTION_POOL_SIZE = 5 +# The number of connections allowed to overflow beyond +# the connection pool size. +CONFIG_DATABASE_CONNECTION_MAX_OVERFLOW = 100 + from pgadmin.utils import env, IS_WIN, fs_short_path ########################################################################## diff --git a/web/pgadmin/model/__init__.py b/web/pgadmin/model/__init__.py index dc439b78e..4c36dd174 100644 --- a/web/pgadmin/model/__init__.py +++ b/web/pgadmin/model/__init__.py @@ -23,7 +23,7 @@ from flask_sqlalchemy import SQLAlchemy from sqlalchemy.ext.mutable import MutableDict import sqlalchemy.types as types import uuid -import json +import config ########################################################################## # @@ -41,7 +41,12 @@ SCHEMA_VERSION = 35 # ########################################################################## -db = SQLAlchemy() +db = SQLAlchemy( + engine_options={ + 'pool_size': config.CONFIG_DATABASE_CONNECTION_POOL_SIZE, + 'max_overflow': config.CONFIG_DATABASE_CONNECTION_MAX_OVERFLOW}) + + USER_ID = 'user.id' SERVER_ID = 'server.id' diff --git a/web/regression/runtests.py b/web/regression/runtests.py index 001cdf98c..77ff56e82 100644 --- a/web/regression/runtests.py +++ b/web/regression/runtests.py @@ -49,9 +49,8 @@ root = os.path.dirname(CURRENT_PATH) if sys.path[0] != root: sys.path.insert(0, root) os.chdir(root) - -from pgadmin import create_app import config +from pgadmin import create_app if config.SERVER_MODE is True: config.SECURITY_RECOVERABLE = True