Browse Source

fix : setting timeouts to one minute in db connections.

re: #775
Signed-off-by: Naveen MR <oof1lab@gmail.com>
refactor/knex-timeout
Naveen MR 3 years ago
parent
commit
a7b290653d
  1. 22
      packages/nc-gui/components/createOrEditProject.vue
  2. 2
      packages/nocodb/src/__tests__/noco/NcConfigFactory.test.ts
  3. 12
      packages/nocodb/src/lib/utils/NcConfigFactory.ts

22
packages/nc-gui/components/createOrEditProject.vue

@ -1098,15 +1098,15 @@ export default {
user: 'postgres', user: 'postgres',
password: 'password', password: 'password',
database: '_dev', database: '_dev',
connectTimeout: 180000, connectTimeout: 60000,
requestTimeout: 180000, requestTimeout: 60000,
ssl: { ssl: {
ca: '', ca: '',
key: '', key: '',
cert: '' cert: ''
} }
}, },
acquireConnectionTimeout: 180000, acquireConnectionTimeout: 60000,
meta: { meta: {
tn: 'nc_evolutions', tn: 'nc_evolutions',
dbAlias: 'db', dbAlias: 'db',
@ -1169,8 +1169,8 @@ export default {
user: 'postgres', user: 'postgres',
password: 'password', password: 'password',
database: '_test', database: '_test',
connectTimeout: 180000, connectTimeout: 60000,
requestTimeout: 180000, requestTimeout: 60000,
ssl: { ssl: {
ca: '', ca: '',
key: '', key: '',
@ -1183,8 +1183,8 @@ export default {
user: 'root', user: 'root',
password: 'password', password: 'password',
database: '_test', database: '_test',
connectTimeout: 180000, connectTimeout: 60000,
requestTimeout: 180000, requestTimeout: 60000,
ssl: { ssl: {
ca: '', ca: '',
key: '', key: '',
@ -1196,7 +1196,7 @@ export default {
port: '15306', port: '15306',
user: 'root', user: 'root',
password: 'password', password: 'password',
database: '_test', database: '_test',
ssl: { ssl: {
ca: '', ca: '',
key: '', key: '',
@ -1208,7 +1208,7 @@ export default {
port: '4000', port: '4000',
user: 'root', user: 'root',
password: '', password: '',
database: '_test', database: '_test',
ssl: { ssl: {
ca: '', ca: '',
key: '', key: '',
@ -1269,8 +1269,8 @@ export default {
user: 'sa', user: 'sa',
password: 'Password123.', password: 'Password123.',
database: '_test', database: '_test',
connectTimeout: 180000, connectTimeout: 60000,
requestTimeout: 180000, requestTimeout: 60000,
ssl: { ssl: {
ca: '', ca: '',
key: '', key: '',

2
packages/nocodb/src/__tests__/noco/NcConfigFactory.test.ts

@ -19,7 +19,7 @@ describe('Config Factory Tests', () => {
ssl: { ssl: {
rejectUnauthorized: false rejectUnauthorized: false
}, },
acquireConnectionTimeout: 600000 acquireConnectionTimeout: 60000
}; };
before(function(done) { before(function(done) {

12
packages/nocodb/src/lib/utils/NcConfigFactory.ts

@ -164,13 +164,15 @@ export default class NcConfigFactory implements NcConfig {
password: password:
url.searchParams.get('p') || url.searchParams.get('password'), url.searchParams.get('p') || url.searchParams.get('password'),
port: +url.port, 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: { // pool: {
// min: 1, // min: 1,
// max: 1 // max: 1
// }, // },
acquireConnectionTimeout: 600000 acquireConnectionTimeout: 60000
} as any; } as any;
if (process.env.NODE_TLS_REJECT_UNAUTHORIZED) { if (process.env.NODE_TLS_REJECT_UNAUTHORIZED) {
@ -268,9 +270,11 @@ export default class NcConfigFactory implements NcConfig {
password: password:
url.searchParams.get('p') || url.searchParams.get('password'), url.searchParams.get('p') || url.searchParams.get('password'),
port: +url.port, 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') ...(url.searchParams.has('search_path')
? { ? {
searchPath: url.searchParams.get('search_path').split(',') searchPath: url.searchParams.get('search_path').split(',')

Loading…
Cancel
Save