Add timeout for write too

This commit is contained in:
Ajay
2022-07-22 17:31:17 -04:00
parent 10491da7c2
commit 071aae5cf7

View File

@@ -37,7 +37,10 @@ export class Postgres implements IDatabase {
constructor(private config: DatabaseConfig) {} constructor(private config: DatabaseConfig) {}
async init(): Promise<void> { async init(): Promise<void> {
this.pool = new Pool(this.config.postgres); this.pool = new Pool({
...this.config.postgres,
statement_timeout: 25000
});
this.pool.on("error", (err, client) => { this.pool.on("error", (err, client) => {
Logger.error(err.stack); Logger.error(err.stack);
this.lastPoolFail = Date.now(); this.lastPoolFail = Date.now();