File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -439,17 +439,20 @@ const POOLS = {}
439439
440440function createPool (config , name ) {
441441 if (getPool (name)) {
442- throw new Error (' Pool with this name already exists' )
442+ return Promise . reject ( new Error (' Pool with this name already exists' ) )
443443 }
444- return POOLS [name] = (new ConnectionPool (config)).connect ()
444+ return (new ConnectionPool (config)).connect ().then ((pool ) => {
445+ return POOLS [name] = pool
446+ })
445447}
446448
447449function closePool (name ) {
448- if ( Object . prototype . hasOwnProperty . apply ( POOLS , name)) {
449- const pool = POOLS [name];
450- delete POOLS [name];
450+ const pool = getPool ( name)
451+ if ( pool) {
452+ delete POOLS [name]
451453 return pool .close ()
452454 }
455+ return Promise .resolve ()
453456}
454457
455458function getPool (name ) {
You can’t perform that action at this time.
0 commit comments