From ddd290c90344241eaa70cb528552e942fd7edec0 Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Tue, 3 Oct 2023 18:19:16 +0200 Subject: [PATCH] fix: timeout issue on long time sql import --- src/main/libs/clients/MySQLClient.ts | 9 ++++++--- src/main/libs/clients/PostgreSQLClient.ts | 9 ++++++--- src/renderer/components/WorkspaceTabQuery.vue | 6 +----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/libs/clients/MySQLClient.ts b/src/main/libs/clients/MySQLClient.ts index 03a690fb..36b24eba 100644 --- a/src/main/libs/clients/MySQLClient.ts +++ b/src/main/libs/clients/MySQLClient.ts @@ -256,9 +256,12 @@ export class MySQLClient extends AntaresCore { } private async keepAlive () { - const connection = await (this._connection as mysql.Pool).getConnection(); - await connection.ping(); - connection.release(); + try { + const connection = await (this._connection as mysql.Pool).getConnection(); + await connection.ping(); + connection.release(); + } + catch (_) {} } use (schema: string) { diff --git a/src/main/libs/clients/PostgreSQLClient.ts b/src/main/libs/clients/PostgreSQLClient.ts index 3ca56863..39c375f5 100644 --- a/src/main/libs/clients/PostgreSQLClient.ts +++ b/src/main/libs/clients/PostgreSQLClient.ts @@ -240,9 +240,12 @@ export class PostgreSQLClient extends AntaresCore { } private async keepAlive () { - const connection = await this._connection.connect() as pg.PoolClient; - await connection.query('SELECT 1+1'); - connection.release(); + try { + const connection = await this._connection.connect() as pg.PoolClient; + await connection.query('SELECT 1+1'); + connection.release(); + } + catch (_) {} } use (schema: string, connection?: pg.Client | pg.PoolClient) { diff --git a/src/renderer/components/WorkspaceTabQuery.vue b/src/renderer/components/WorkspaceTabQuery.vue index 6772d214..50ecfd20 100644 --- a/src/renderer/components/WorkspaceTabQuery.vue +++ b/src/renderer/components/WorkspaceTabQuery.vue @@ -27,11 +27,7 @@ :title="t('general.cancel')" @click="killTabQuery()" > - + {{ t('general.run') }}