lower active connections on error

This commit is contained in:
Ajay
2022-11-13 23:21:46 -05:00
parent 1fffd2e6ac
commit 4139bf8f8c

View File

@@ -155,12 +155,12 @@ export class Postgres implements IDatabase {
} }
} }
this.activePostgresRequests--;
Logger.error(`prepare (postgres) try ${tries}: ${err}`); Logger.error(`prepare (postgres) try ${tries}: ${err}`);
} }
} while (this.isReadQuery(type) && tries < maxTries() } while (this.isReadQuery(type) && tries < maxTries()
&& this.activePostgresRequests < this.config.postgresReadOnly.stopRetryThreshold); && this.activePostgresRequests < this.config.postgresReadOnly.stopRetryThreshold);
this.activePostgresRequests--;
throw new Error(`prepare (postgres): ${type} ${query} failed after ${tries} tries`); throw new Error(`prepare (postgres): ${type} ${query} failed after ${tries} tries`);
} }