From 5c37c3bf19143f2d9dba3c00301d86391f276e7d Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 21 Oct 2024 13:46:58 +0300 Subject: [PATCH] feat(redshift-driver): optimize testConnection() with just establishing connection without real query --- .../cubejs-redshift-driver/src/RedshiftDriver.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/cubejs-redshift-driver/src/RedshiftDriver.ts b/packages/cubejs-redshift-driver/src/RedshiftDriver.ts index cb3ced34ac94f..ad40881e2be34 100644 --- a/packages/cubejs-redshift-driver/src/RedshiftDriver.ts +++ b/packages/cubejs-redshift-driver/src/RedshiftDriver.ts @@ -107,6 +107,16 @@ export class RedshiftDriver extends PostgresDriver } } + /** + * AWS Redshift doesn't have any special connection check. + * And querying even system tables is billed. + * @override + */ + public async testConnection() { + const conn = await this.pool.connect(); + conn.release(); + } + public override async stream( query: string, values: unknown[], @@ -287,8 +297,7 @@ export class RedshiftDriver extends PostgresDriver }; } finally { conn.removeAllListeners('notice'); - - await conn.release(); + conn.release(); } }