Close database connections after 10 seconds (experimental)

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2023-04-07 22:02:37 +02:00
parent 505a94e3aa
commit 6ac36fdb69
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 4 additions and 0 deletions

View File

@ -221,6 +221,10 @@ if _db_type == 'mysql' or _db_type.startswith('postgres') or _db_type == 'psql':
'PORT': os.environ.get('DJANGO_DB_PORT', ''), # Use default port
}
}
# Connections expire after 10 seconds
CONN_MAX_AGE = 10
CONN_HEALTH_CHECKS = True
else:
DATABASES = {
'default': {