Skip to content

Commit d2c71eb

Browse files
committed
configure django's database connections
1 parent 42fdd7e commit d2c71eb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tcf_core/settings/base.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@
104104
"PASSWORD": env.str("AWS_RDS_PASSWORD"),
105105
"HOST": env.str("AWS_RDS_HOST"),
106106
"PORT": env.int("AWS_RDS_PORT"),
107+
# Connection pooling - reuse connections between requests
108+
"CONN_MAX_AGE": 60, # Keep connections alive for 60 seconds
109+
110+
# Health checks (Django 4.1+) - verify connection is still valid
111+
"CONN_HEALTH_CHECKS": True,
112+
113+
# Database connection options
114+
"OPTIONS": {
115+
"connect_timeout": 10, # Timeout for establishing connection
116+
"options": "-c statement_timeout=30000", # 30 second query timeout
117+
},
107118
}
108119
}
109120

0 commit comments

Comments
 (0)