Skip to content

Commit

Permalink
Make SQLAlchemy engine options POOL_SIZE & MAX_OVERFLOW configurable.#…
Browse files Browse the repository at this point in the history
  • Loading branch information
yogeshmahajan-1903 committed Aug 14, 2023
1 parent 2c81b33 commit c8e7f2a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions web/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
if sys.path[0] != root:
sys.path.insert(0, root)

# The number of connections to keep open inside the connection pool.
# A SQLITE_CONNECTION_POOL_SIZE setting of 0 indicates no limit.
SQLITE_CONNECTION_POOL_SIZE = 7
# The number of connections to allow in connection pool "overflow".
# These connections that can be opened above and beyond the pool_size setting
SQLITE_CONNECTION_MAX_OVERFLOW = 1000
# Note - This are imported because of circular import error

from pgadmin.utils import env, IS_WIN, fs_short_path

##########################################################################
Expand Down
8 changes: 6 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,11 @@
#
##########################################################################

db = SQLAlchemy()
db = SQLAlchemy(
engine_options={'pool_size': config.SQLITE_CONNECTION_POOL_SIZE,
'max_overflow': config.SQLITE_CONNECTION_MAX_OVERFLOW})


USER_ID = 'user.id'
SERVER_ID = 'server.id'

Expand Down

0 comments on commit c8e7f2a

Please sign in to comment.