Add DB connection resilience settings (#89)
## Summary - Add `queue_target` (2s) and `queue_interval` (5s) to Repo config so DBConnection proactively replaces stale connections when queries slow down - Add TCP `keepalive: true` to prevent network intermediaries from silently dropping idle SSL connections Addresses the `ssl recv: closed` errors crashing `Oban.Met.Reporter` in production. ## Test plan - [x] Config-only change, compiles cleanly - [x] Pre-commit hooks pass Reviewed-on: graham/towerops-web#89
This commit is contained in:
parent
933bfafeb0
commit
8cf851d9e6
1 changed files with 7 additions and 3 deletions
|
|
@ -307,9 +307,13 @@ if config_env() == :prod do
|
|||
ssl: ssl_config,
|
||||
url: database_url,
|
||||
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "20"),
|
||||
# For machines with several cores, consider starting multiple pools of `pool_size`
|
||||
# pool_count: 4,
|
||||
socket_options: maybe_ipv6
|
||||
# Detect stale connections faster: if a query takes longer than queue_target (2s)
|
||||
# on average over queue_interval (5s), DBConnection will disconnect idle connections
|
||||
# to cycle in fresh ones. Helps recover from "ssl recv: closed" errors.
|
||||
queue_target: 2_000,
|
||||
queue_interval: 5_000,
|
||||
# TCP keepalive prevents proxies/firewalls from dropping idle connections
|
||||
socket_options: maybe_ipv6 ++ [keepalive: true]
|
||||
|
||||
config :towerops, Towerops.Vault,
|
||||
ciphers: [
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue