mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 13:11:02 +00:00
feat(api): configurable max pool connections
This should help with failing health checks while the crawler is running. Quick math: 10 users, 30 songs each, each song requires at least 3 queries => 900 db queries every minute. With the default of 10 pool connections, this blocks all available db bandwidth for some time and causes slow UI and failing healthchecks.
This commit is contained in:
parent
7de5e14d4e
commit
ee5bd41a37
5 changed files with 12 additions and 0 deletions
|
|
@ -41,6 +41,7 @@ All configuration must be set as environment variables. Default values are added
|
||||||
- `DB_USERNAME`: _Required_, Database username
|
- `DB_USERNAME`: _Required_, Database username
|
||||||
- `DB_PASSWORD`: _Required_, Database password
|
- `DB_PASSWORD`: _Required_, Database password
|
||||||
- `DB_DATABASE`: _Required_, Database database
|
- `DB_DATABASE`: _Required_, Database database
|
||||||
|
- `DB_POOL_MAX`: **50**, max concurrent database connections
|
||||||
|
|
||||||
#### Sentry
|
#### Sentry
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ spec:
|
||||||
key: postgres-password
|
key: postgres-password
|
||||||
- name: DB_DATABASE
|
- name: DB_DATABASE
|
||||||
value: {{ .Values.externalDatabase.database }}
|
value: {{ .Values.externalDatabase.database }}
|
||||||
|
- name: DB_POOL_MAX
|
||||||
|
value: "{{ .Values.database.poolMax }}"
|
||||||
- name: JWT_SECRET
|
- name: JWT_SECRET
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,9 @@ externalDatabase:
|
||||||
password:
|
password:
|
||||||
database:
|
database:
|
||||||
|
|
||||||
|
database:
|
||||||
|
poolMax: 50
|
||||||
|
|
||||||
spotify:
|
spotify:
|
||||||
clientId:
|
clientId:
|
||||||
clientSecret:
|
clientSecret:
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ import { ConfigModule as NestConfigModule } from "@nestjs/config";
|
||||||
DB_USERNAME: Joi.string().required(),
|
DB_USERNAME: Joi.string().required(),
|
||||||
DB_PASSWORD: Joi.string().required(),
|
DB_PASSWORD: Joi.string().required(),
|
||||||
DB_DATABASE: Joi.string().required(),
|
DB_DATABASE: Joi.string().required(),
|
||||||
|
DB_POOL_MAX: Joi.number().default(50),
|
||||||
|
|
||||||
// Sentry (Optional)
|
// Sentry (Optional)
|
||||||
SENTRY_ENABLED: Joi.boolean().default(false),
|
SENTRY_ENABLED: Joi.boolean().default(false),
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,11 @@ export const DatabaseModule = TypeOrmModule.forRootAsync({
|
||||||
migrationsRun: true,
|
migrationsRun: true,
|
||||||
migrations: [join(__dirname, "migrations", "*.{ts,js}")],
|
migrations: [join(__dirname, "migrations", "*.{ts,js}")],
|
||||||
|
|
||||||
|
// PG Driver Options
|
||||||
|
extra: {
|
||||||
|
max: config.get<number>("DB_POOL_MAX"),
|
||||||
|
},
|
||||||
|
|
||||||
// Debug/Development Options
|
// Debug/Development Options
|
||||||
//
|
//
|
||||||
// logging: true,
|
// logging: true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue