Skip to content

ceoro9/connection-pool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Connection Pool

General service-agnostic implemention of simple connection pool in TypeScript.

Installation

npm install

Compiling

npm run build

Usage

import ConnectionPool from 'connection-pool';

const getNewConnection = () => new Promise(...);
const pool = new ConnectionsPool(5, getNewConnection);

(async function () {
  try {
    const connection = await pool.getConnection();
    // some operations
    connection.release();
  } catch (e) {
    console.log(e);
  } finally {
    pool.close();
  }
})();

TODO

  1. Add unit tests
  2. Make ConnectionPool to emit events after connection was established, acquired and etc.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors