From 071aae5cf7b8a363b983c80bb787718047d5f8e8 Mon Sep 17 00:00:00 2001 From: Ajay Date: Fri, 22 Jul 2022 17:31:17 -0400 Subject: [PATCH] Add timeout for write too --- src/databases/Postgres.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/databases/Postgres.ts b/src/databases/Postgres.ts index 71571b1..dbaddb1 100644 --- a/src/databases/Postgres.ts +++ b/src/databases/Postgres.ts @@ -37,7 +37,10 @@ export class Postgres implements IDatabase { constructor(private config: DatabaseConfig) {} async init(): Promise { - this.pool = new Pool(this.config.postgres); + this.pool = new Pool({ + ...this.config.postgres, + statement_timeout: 25000 + }); this.pool.on("error", (err, client) => { Logger.error(err.stack); this.lastPoolFail = Date.now();