Browse Source

set min max for knex pool

Signed-off-by: Vijay Kumar Rathore <professional.vijay8492@gmail.com>
pull/3944/head
Vijay Kumar Rathore 2 years ago
parent
commit
176929f976
  1. 10
      packages/nocodb/src/lib/utils/NcConfigFactory.ts
  2. 6
      packages/nocodb/src/lib/utils/common/NcConnectionMgrv2.ts

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

@ -41,6 +41,14 @@ const defaultConnectionConfig: any = {
dateStrings: true, dateStrings: true,
}; };
// default knex options
const defaultConnectionOptions = {
pool: {
min: 0,
max: 10
}
};
const knownQueryParams = [ const knownQueryParams = [
{ {
parameter: 'database', parameter: 'database',
@ -733,7 +741,7 @@ export default class NcConfigFactory implements NcConfig {
// } // }
} }
export { defaultConnectionConfig }; export { defaultConnectionConfig, defaultConnectionOptions };
/** /**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd * @copyright Copyright (c) 2021, Xgene Cloud Ltd

6
packages/nocodb/src/lib/utils/common/NcConnectionMgrv2.ts

@ -5,7 +5,10 @@ import { XKnex } from '../../db/sql-data-mapper';
// import Knex from 'knex'; // import Knex from 'knex';
// import NcMetaIO from '../meta/NcMetaIO'; // import NcMetaIO from '../meta/NcMetaIO';
import { defaultConnectionConfig } from '../NcConfigFactory'; import {
defaultConnectionConfig,
defaultConnectionOptions
} from '../NcConfigFactory';
import Base from '../../models/Base'; import Base from '../../models/Base';
import Noco from '../../Noco'; import Noco from '../../Noco';
@ -99,6 +102,7 @@ export default class NcConnectionMgrv2 {
// ? (connectionConfig.connection as Knex.Config) // ? (connectionConfig.connection as Knex.Config)
// : // :
{ {
...defaultConnectionOptions,
...connectionConfig, ...connectionConfig,
connection: { connection: {
...defaultConnectionConfig, ...defaultConnectionConfig,

Loading…
Cancel
Save