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. 18
      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

18
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: '',
@ -1269,8 +1269,8 @@ export default {
user: 'sa',
password: 'Password123.',
database: '_test',
connectTimeout: 180000,
requestTimeout: 180000,
connectTimeout: 60000,
requestTimeout: 60000,
ssl: {
ca: '',
key: '',

2
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) {

12
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(',')

Loading…
Cancel
Save