1- import knex , { Knex } from 'knex' ;
21import getPort from 'get-port' ;
2+ import knex , { Knex } from 'knex' ;
3+ import { LRUStorage } from '../caching/lru-storage.js' ;
34import { ConnectionParams } from '../data-access-layer/shared/data-structures/connections-params.ds.js' ;
45import { getTunnel } from '../helpers/get-ssh-tunnel.js' ;
5- import { LRUStorage } from '../caching/lru-storage.js' ;
66export class KnexManager {
77 static knexStorage ( ) {
88 const knexMap = new Map < ConnectionParams [ 'type' ] , ( connection : ConnectionParams ) => Promise < Knex < any , any [ ] > > > ( ) ;
@@ -126,6 +126,7 @@ export class KnexManager {
126126
127127 private static getPostgresKnex ( connection : ConnectionParams ) : Knex < any , any [ ] > {
128128 const { host, username, password, database, port, type, cert, ssl } = connection ;
129+ const pool = { min : 0 , max : 3 } ;
129130 if ( process . env . NODE_ENV === 'test' ) {
130131 const newKnex = knex ( {
131132 client : type ,
@@ -137,6 +138,7 @@ export class KnexManager {
137138 port : port ,
138139 application_name : 'rocketadmin' ,
139140 } ,
141+ pool,
140142 } ) ;
141143 return newKnex ;
142144 }
@@ -155,6 +157,7 @@ export class KnexManager {
155157 rejectUnauthorized : false ,
156158 } ,
157159 } ,
160+ pool,
158161 } ) ;
159162 return newKnex ;
160163 }
@@ -169,6 +172,7 @@ export class KnexManager {
169172 application_name : 'rocketadmin' ,
170173 ssl : ssl ? { ca : cert ?? undefined , rejectUnauthorized : ! cert } : false ,
171174 } ,
175+ pool,
172176 } ) ;
173177 return newKnex ;
174178 }
0 commit comments