fix(api): reduce the number of connection used by pgpool.

There should be no use of much more than two pgconnection per worker,
even in the case where there is "some" asynchronous code interleaved
between synchronous code. The new async code is using its own pg pool
that has max=four.

ref: See max_size at
https://www.psycopg.org/psycopg3/docs/api/pool.html#the-connectionpool-class
This commit is contained in:
ⵄⵎⵉⵔⵓⵛ ⴰⵎⴰⵣⵉⵖ 2023-11-30 17:55:26 +01:00
parent feed02ff10
commit 41c7560739

View file

@ -64,8 +64,8 @@ def make_pool():
except (Exception, psycopg2.DatabaseError) as error:
logging.error("Error while closing all connexions to PostgreSQL", error)
try:
postgreSQL_pool = ORThreadedConnectionPool(config("PG_MINCONN", cast=int, default=20),
config("PG_MAXCONN", cast=int, default=80),
postgreSQL_pool = ORThreadedConnectionPool(config("PG_MINCONN", cast=int, default=4),
config("PG_MAXCONN", cast=int, default=8),
**PG_CONFIG)
if (postgreSQL_pool):
logging.info("Connection pool created successfully")