From a7b290653d898d12afd10e4993f71181d276a4e5 Mon Sep 17 00:00:00 2001 From: Naveen MR Date: Fri, 18 Feb 2022 16:14:26 +0000 Subject: [PATCH] fix : setting timeouts to one minute in db connections. re: #775 Signed-off-by: Naveen MR --- .../nc-gui/components/createOrEditProject.vue | 22 +++++++++---------- .../__tests__/noco/NcConfigFactory.test.ts | 2 +- .../nocodb/src/lib/utils/NcConfigFactory.ts | 12 ++++++---- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/packages/nc-gui/components/createOrEditProject.vue b/packages/nc-gui/components/createOrEditProject.vue index 18397afe98..1f2240bec8 100644 --- a/packages/nc-gui/components/createOrEditProject.vue +++ b/packages/nc-gui/components/createOrEditProject.vue @@ -1098,15 +1098,15 @@ export default { user: 'postgres', password: 'password', database: '_dev', - connectTimeout: 180000, - requestTimeout: 180000, + connectTimeout: 60000, + requestTimeout: 60000, ssl: { ca: '', key: '', cert: '' } }, - acquireConnectionTimeout: 180000, + acquireConnectionTimeout: 60000, meta: { tn: 'nc_evolutions', dbAlias: 'db', @@ -1169,8 +1169,8 @@ export default { user: 'postgres', password: 'password', database: '_test', - connectTimeout: 180000, - requestTimeout: 180000, + connectTimeout: 60000, + requestTimeout: 60000, ssl: { ca: '', key: '', @@ -1183,8 +1183,8 @@ export default { user: 'root', password: 'password', database: '_test', - connectTimeout: 180000, - requestTimeout: 180000, + connectTimeout: 60000, + requestTimeout: 60000, ssl: { ca: '', key: '', @@ -1196,7 +1196,7 @@ export default { port: '15306', user: 'root', password: 'password', - database: '_test', + database: '_test', ssl: { ca: '', key: '', @@ -1208,7 +1208,7 @@ export default { port: '4000', user: 'root', password: '', - database: '_test', + database: '_test', ssl: { ca: '', key: '', @@ -1269,8 +1269,8 @@ export default { user: 'sa', password: 'Password123.', database: '_test', - connectTimeout: 180000, - requestTimeout: 180000, + connectTimeout: 60000, + requestTimeout: 60000, ssl: { ca: '', key: '', diff --git a/packages/nocodb/src/__tests__/noco/NcConfigFactory.test.ts b/packages/nocodb/src/__tests__/noco/NcConfigFactory.test.ts index c33ddf9bc1..243302b59c 100644 --- a/packages/nocodb/src/__tests__/noco/NcConfigFactory.test.ts +++ b/packages/nocodb/src/__tests__/noco/NcConfigFactory.test.ts @@ -19,7 +19,7 @@ describe('Config Factory Tests', () => { ssl: { rejectUnauthorized: false }, - acquireConnectionTimeout: 600000 + acquireConnectionTimeout: 60000 }; before(function(done) { diff --git a/packages/nocodb/src/lib/utils/NcConfigFactory.ts b/packages/nocodb/src/lib/utils/NcConfigFactory.ts index 0ac88543e8..8a0854e1af 100644 --- a/packages/nocodb/src/lib/utils/NcConfigFactory.ts +++ b/packages/nocodb/src/lib/utils/NcConfigFactory.ts @@ -164,13 +164,15 @@ export default class NcConfigFactory implements NcConfig { password: url.searchParams.get('p') || url.searchParams.get('password'), port: +url.port, - user: url.searchParams.get('u') || url.searchParams.get('user') + user: url.searchParams.get('u') || url.searchParams.get('user'), + connectTimeout: url.searchParams.get('connectTimeout') || 60000, + requestTimeout: url.searchParams.get('requestTimeout') || 60000 }, // pool: { // min: 1, // max: 1 // }, - acquireConnectionTimeout: 600000 + acquireConnectionTimeout: 60000 } as any; if (process.env.NODE_TLS_REJECT_UNAUTHORIZED) { @@ -268,9 +270,11 @@ export default class NcConfigFactory implements NcConfig { password: url.searchParams.get('p') || url.searchParams.get('password'), port: +url.port, - user: url.searchParams.get('u') || url.searchParams.get('user') + user: url.searchParams.get('u') || url.searchParams.get('user'), + connectTimeout: url.searchParams.get('connectTimeout') || 60000, + requestTimeout: url.searchParams.get('requestTimeout') || 60000 }, - acquireConnectionTimeout: 600000, + acquireConnectionTimeout: 60000, ...(url.searchParams.has('search_path') ? { searchPath: url.searchParams.get('search_path').split(',')