resource-pools-connection
v2.0.3
Published
Extension of 'tedious' connection class to use as a pooled promised resource without need to wait for release
Downloads
3
Maintainers
Readme
resource-pools-connection
Extension of 'tedious' connection class for using as a pooled resource with resource-pools package, without blocking in busy state.
usage
Setup connection pool:
const {ResourcePool} = require('resource-pools');
const {ConnectionResource} = require('resource-pools-connection');
const config = {
constructor: ConnectionResource,
arguments: [/* your 'tedious' connection config object here */],
maxCount: /* number of maximum pooled connections */
} ;
const dbConnections = new ResourcePool(config);
Run DB request:
dbConnections.allocate().then( conn => {
conn.execSql(request);
})