🔧(backend) enable psycopg-pool allowing configuring min and max size
We enable the pool option on the DB configuration. We want to allow the configuration of the min and max sixe in a first time. They can be configured using the settings DB_PSYCOPG_POOL_MIN_SIZE and DB_PSYCOPG_POOL_MAX_SIZE. They have their default value to 4 and None.
This commit is contained in:
@@ -46,6 +46,8 @@ These are the environment variables you can set for the `impress-backend` contai
|
||||
| DB_NAME | Name of the database | impress |
|
||||
| DB_PASSWORD | Password to authenticate with | pass |
|
||||
| DB_PORT | Port of the database | 5432 |
|
||||
| DB_PSYCOPG_POOL_MIN_SIZE | The psycopg min pool size | 4 |
|
||||
| DB_PSYCOPG_POOL_MAX_SIZE | The psycopg max pool size | None |
|
||||
| DB_USER | User to authenticate with | dinum |
|
||||
| DJANGO_ALLOWED_HOSTS | Allowed hosts | [] |
|
||||
| DJANGO_CELERY_BROKER_TRANSPORT_OPTIONS | Celery broker transport options | {} |
|
||||
|
||||
@@ -99,6 +99,19 @@ class Base(Configuration):
|
||||
"localhost", environ_name="DB_HOST", environ_prefix=None
|
||||
),
|
||||
"PORT": values.Value(5432, environ_name="DB_PORT", environ_prefix=None),
|
||||
"OPTIONS": {
|
||||
# https://www.psycopg.org/psycopg3/docs/api/pool.html#psycopg_pool.ConnectionPool
|
||||
"pool": {
|
||||
"min_size": values.IntegerValue(
|
||||
4, environ_name="DB_PSYCOPG_POOL_MIN_SIZE", environ_prefix=None
|
||||
),
|
||||
"max_size": values.IntegerValue(
|
||||
None,
|
||||
environ_name="DB_PSYCOPG_POOL_MAX_SIZE",
|
||||
environ_prefix=None,
|
||||
),
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
|
||||
|
||||
Reference in New Issue
Block a user