diff --git a/src/config.ts b/src/config.ts index 91020b6..3c28819 100644 --- a/src/config.ts +++ b/src/config.ts @@ -77,7 +77,7 @@ addDefaults(config, { max: 10, idleTimeoutMillis: 10000, maxTries: 3, - maxActiveRequests: -1 + maxActiveRequests: 0 }, postgresReadOnly: { enabled: false, diff --git a/src/databases/Postgres.ts b/src/databases/Postgres.ts index a47da54..5253ad1 100644 --- a/src/databases/Postgres.ts +++ b/src/databases/Postgres.ts @@ -105,7 +105,8 @@ export class Postgres implements IDatabase { Logger.debug(`prepare (postgres): type: ${type}, query: ${query}, params: ${params}`); - if (this.activePostgresRequests > this.config.postgres.maxActiveRequests) { + if (this.config.postgres.maxActiveRequests + && this.activePostgresRequests > this.config.postgres.maxActiveRequests) { throw new Error("Too many active postgres requests"); }