Skip to content

Commit 833ce97

Browse files
binaryknotclaude
andauthored
feat(lago-rails): configurable DB session timeouts (INF-294) (#225)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 33a8974 commit 833ce97

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

charts/lago-rails/templates/deployment.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,22 @@ spec:
7373
- name: DATABASE_PREPARED_STATEMENTS
7474
value: {{ .Values.global.database.preparedStatement | quote }}
7575
{{- end }}
76+
{{/* DB session timeouts. Per-instance override wins over the umbrella default; rendered only when set so an unset value falls back to the Postgres server default. */}}
77+
{{- $statementTimeout := default .Values.global.database.statementTimeout .Values.config.database.statementTimeout }}
78+
{{- if $statementTimeout }}
79+
- name: LAGO_DATABASE_STATEMENT_TIMEOUT
80+
value: {{ $statementTimeout | quote }}
81+
{{- end }}
82+
{{- $idleInTransactionTimeout := default .Values.global.database.idleInTransactionTimeout .Values.config.database.idleInTransactionTimeout }}
83+
{{- if $idleInTransactionTimeout }}
84+
- name: LAGO_DATABASE_IDLE_TX_TIMEOUT
85+
value: {{ $idleInTransactionTimeout | quote }}
86+
{{- end }}
87+
{{- $lockTimeout := default .Values.global.database.lockTimeout .Values.config.database.lockTimeout }}
88+
{{- if $lockTimeout }}
89+
- name: LAGO_DATABASE_LOCK_TIMEOUT
90+
value: {{ $lockTimeout | quote }}
91+
{{- end }}
7692
- name: LAGO_SIDEKIQ_PRO_REQUIRED
7793
value: {{ .Values.global.sidekiq.pro | quote }}
7894
- name: LAGO_SIDEKIQ_WEB

charts/lago-rails/values.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,21 @@ global:
7676
# explicitly set.
7777
# @section -- Database
7878
preparedStatement:
79+
# -- (int, milliseconds) Per-instance `statement_timeout`, rendered as
80+
# `LAGO_DATABASE_STATEMENT_TIMEOUT`. Overrides `global.database.statementTimeout`.
81+
# Unset → falls back to the Postgres server default.
82+
# @section -- Database
83+
statementTimeout:
84+
# -- (int, milliseconds) Per-instance `idle_in_transaction_session_timeout`,
85+
# rendered as `LAGO_DATABASE_IDLE_TX_TIMEOUT`. Overrides
86+
# `global.database.idleInTransactionTimeout`. Unset → Postgres server default.
87+
# @section -- Database
88+
idleInTransactionTimeout:
89+
# -- (int, milliseconds) Per-instance `lock_timeout`, rendered as
90+
# `LAGO_DATABASE_LOCK_TIMEOUT`. Overrides `global.database.lockTimeout`.
91+
# Unset → Postgres server default.
92+
# @section -- Database
93+
lockTimeout:
7994

8095
encryption:
8196
# -- Primary encryption key (`openssl rand -hex 16`)

charts/lago/values.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,21 @@ global:
8181
# explicitly set.
8282
# @section -- Database
8383
preparedStatement:
84+
# -- (int, milliseconds) Default `statement_timeout` for every Rails pod,
85+
# rendered as `LAGO_DATABASE_STATEMENT_TIMEOUT`. Per-component
86+
# `config.database.statementTimeout` overrides. Unset → Postgres server default.
87+
# @section -- Database
88+
statementTimeout:
89+
# -- (int, milliseconds) Default `idle_in_transaction_session_timeout`,
90+
# rendered as `LAGO_DATABASE_IDLE_TX_TIMEOUT`. Per-component override via
91+
# `config.database.idleInTransactionTimeout`. Unset → Postgres server default.
92+
# @section -- Database
93+
idleInTransactionTimeout:
94+
# -- (int, milliseconds) Default `lock_timeout`, rendered as
95+
# `LAGO_DATABASE_LOCK_TIMEOUT`. Per-component override via
96+
# `config.database.lockTimeout`. Unset → Postgres server default.
97+
# @section -- Database
98+
lockTimeout:
8499

85100
encryption:
86101
# -- Primary encryption key (`openssl rand -hex 16`)

0 commit comments

Comments
 (0)