diff --git a/api/.env.default b/api/.env.default index 30ff0b02d..aa14fc993 100644 --- a/api/.env.default +++ b/api/.env.default @@ -36,7 +36,8 @@ pg_password=asayerPostgres pg_port=5432 pg_user=postgres pg_timeout=30 -pg_minconn=45 +pg_minconn=20 +pg_maxconn=50 PG_RETRY_MAX=50 PG_RETRY_INTERVAL=2 put_S3_TTL=20 diff --git a/api/Dockerfile.alerts b/api/Dockerfile.alerts index 7d8dd8200..65668f79b 100644 --- a/api/Dockerfile.alerts +++ b/api/Dockerfile.alerts @@ -3,6 +3,7 @@ LABEL Maintainer="Rajesh Rajendran" LABEL Maintainer="KRAIEM Taha Yassine" ENV APP_NAME alerts ENV pg_minconn 2 +ENV pg_maxconn 10 # Add Tini # Startup daemon ENV TINI_VERSION v0.19.0 diff --git a/api/chalicelib/utils/pg_client.py b/api/chalicelib/utils/pg_client.py index 3d60dda5c..1c4625873 100644 --- a/api/chalicelib/utils/pg_client.py +++ b/api/chalicelib/utils/pg_client.py @@ -52,7 +52,9 @@ def make_pool(): except (Exception, psycopg2.DatabaseError) as error: print("Error while closing all connexions to PostgreSQL", error) try: - postgreSQL_pool = ORThreadedConnectionPool(config("pg_minconn", cast=int, default=20), 100, **PG_CONFIG) + postgreSQL_pool = ORThreadedConnectionPool(config("pg_minconn", cast=int, default=20), + config("pg_maxconn", cast=int, default=80), + **PG_CONFIG) if (postgreSQL_pool): print("Connection pool created successfully") except (Exception, psycopg2.DatabaseError) as error: diff --git a/ee/api/.env.default b/ee/api/.env.default index 8215908b2..7687566d7 100644 --- a/ee/api/.env.default +++ b/ee/api/.env.default @@ -45,7 +45,8 @@ pg_password=asayerPostgres pg_port=5432 pg_user=postgres pg_timeout=30 -pg_minconn=45 +pg_minconn=20 +pg_maxconn=50 PG_RETRY_MAX=50 PG_RETRY_INTERVAL=2 put_S3_TTL=20 diff --git a/ee/api/Dockerfile.alerts b/ee/api/Dockerfile.alerts index ae8d308c8..1deff0a57 100644 --- a/ee/api/Dockerfile.alerts +++ b/ee/api/Dockerfile.alerts @@ -4,6 +4,7 @@ LABEL Maintainer="KRAIEM Taha Yassine" RUN apt-get update && apt-get install -y pkg-config libxmlsec1-dev gcc && rm -rf /var/lib/apt/lists/* ENV APP_NAME alerts ENV pg_minconn 2 +ENV pg_maxconn 10 # Add Tini # Startup daemon