Skip to content

Commit 3c20346

Browse files
authored
feat(redshift-driver): optimize testConnection() with just establishing connection without real query (#8847)
1 parent 99ad335 commit 3c20346

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/cubejs-redshift-driver/src/RedshiftDriver.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ export class RedshiftDriver extends PostgresDriver<RedshiftDriverConfiguration>
107107
}
108108
}
109109

110+
/**
111+
* AWS Redshift doesn't have any special connection check.
112+
* And querying even system tables is billed.
113+
* @override
114+
*/
115+
public async testConnection() {
116+
const conn = await this.pool.connect();
117+
conn.release();
118+
}
119+
110120
public override async stream(
111121
query: string,
112122
values: unknown[],
@@ -287,8 +297,7 @@ export class RedshiftDriver extends PostgresDriver<RedshiftDriverConfiguration>
287297
};
288298
} finally {
289299
conn.removeAllListeners('notice');
290-
291-
await conn.release();
300+
conn.release();
292301
}
293302
}
294303

0 commit comments

Comments
 (0)