Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make SQLAlchemy engine options POOL_SIZE & MAX_OVERFLOW configurable #6208 #6681

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions web/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
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

##########################################################################
Expand Down
9 changes: 7 additions & 2 deletions web/pgadmin/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from sqlalchemy.ext.mutable import MutableDict
import sqlalchemy.types as types
import uuid
import json
import config

##########################################################################
#
Expand All @@ -41,7 +41,12 @@
#
##########################################################################

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'

Expand Down
3 changes: 1 addition & 2 deletions web/regression/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@
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
Expand Down
Loading