Skip to content

Commit 6428cf8

Browse files
committed
refactor to connector itself
1 parent d03fdce commit 6428cf8

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

src/connection/base.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export abstract class Connection {
5454

5555
abstract resolveEngineEndpoint(): Promise<string>;
5656

57+
abstract testConnection(): Promise<void>;
58+
5759
protected getRequestUrl(executeQueryOptions: ExecuteQueryOptions): string {
5860
const params = this.getBaseParameters(executeQueryOptions);
5961

src/connection/connection_v1.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,8 @@ export class ConnectionV1 extends BaseConnection {
5959
}
6060
return this.accountInfo;
6161
}
62+
63+
async testConnection() {
64+
await this.execute("select 1");
65+
}
6266
}

src/connection/connection_v2.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,9 @@ export class ConnectionV2 extends BaseConnection {
6969

7070
return this.engineEndpoint;
7171
}
72+
73+
async testConnection() {
74+
const settings = { internal: [{ auto_start_stop_control: "ignore" }] };
75+
await this.execute("select 1", { settings });
76+
}
7277
}

src/core/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ export class FireboltCore {
3131
const connection = makeConnection(this.context, connectionOptions);
3232
await auth.authenticate();
3333
await connection.resolveEngineEndpoint();
34-
// auto_start_stop_control is only available for v2
35-
const settings = auth.isServiceAccount()
36-
? { internal: [{ auto_start_stop_control: "ignore" }] }
37-
: {};
38-
await connection.execute("select 1", { settings });
34+
await connection.testConnection();
3935
}
4036
}

0 commit comments

Comments
 (0)