Stop postgres retries when over a threshold

This commit is contained in:
Ajay
2022-10-26 22:58:35 -04:00
parent 13ae4681cb
commit 9e3d059d10
3 changed files with 5 additions and 2 deletions

View File

@@ -148,7 +148,8 @@ export class Postgres implements IDatabase {
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--;
throw new Error(`prepare (postgres): ${type} ${query} failed after ${tries} tries`);