npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

v-pool

v1.1.3

Published

Connection pool for Vertica

Downloads

2,561

Readme

v-pool

License NPM version NPM downloads

Enables connection pooling with the vertica-nodejs driver

Documentation

v-pool is part of a much larger project, vertica-nodejs. While each individual package should have its own documentation for exposing and detailing related components of the vertica-nodejs API, the main location for those using the driver can be found here:

Other packages part of the vertica-nodejs project can be found here:

Constructor

new Pool([config: object])

The Pool's config object supports all of the same config options that is supported by a Client. The Pool config also supports these four additional options:

  • connectionTimeoutMillis (int) - number of milliseconds to wait before timing out when connecting a client
    • default: 0 (no timeout)
  • idleTimeoutMillis (int) - number of milliseconds an idle client in the pool will without being checked out before being discarded by the backend
    • default: 10000 (10 seconds)
    • value of 0 disables disconnection of idle clients automatically
  • max (int) - maximum number of clients the Pool will hold
    • default: 10
    • allowExitOnIdle (boolean) - allows node event loop to exit when clients in the pool are idle, but not yet discarded from idleTimeoutMillis expiration. Prevents waiting on timeout when no work is being done or expected to be done (think scripting/testing)

pool.connect(callback: (err?: Error, client?: pg.Client, release?: releaseCallback) => void) => void

Acquires a client or queues to acquire a client from the pool (if no available clients). If a pool has less than the max amount of clients, a new client will be created.

pool.connect() => Promise<pg.Client>

Acquiring a client via promise.

releaseCallback

The releaseCallback releases a client back into the pool. You must call the releaseCallback, otherwise the number of available clients will dwindle and eventually run out if you are using clients faster than the connectionTimeoutMillis setting will return idle clients the pool on its own.

Clients issued by a connection pool will have a release method. This method is the same method provided to the connect callback if using the pool with callbacks.

pool.query

Connection pools have a built in convenience for running single queries. pool.query will find the first available client and execute the query on this client, returning the result, and then releasing the client back into the pool on its own. This is for convenience, however, NO queries needing transactional integrity should be submitted this way. Transactions are scoped to individual clients and using pool.query in succession will almost certainly use multiple clients.

pool.end

pool.end will drain the pool of active clients, making sure they are disconnected and all timers are neglected. This is the best and most complete way to clean up after all work has been done.

Emitted events

Pool is an instance of EventEmitter and issues the following events:

  • connect: when a new client connection is establisehd and added to the pool
    • pool.on('conect', (client: Client) => void) => void
  • acquire: when a client is checked out from the existing pool
    • pool.on('acquire', (client: Client) => void) => void
  • error: in the event of an error on the backend, can be emitted by active and idle clients
    • pool.on('error', (err: Error, client: Client) +. void) => void
  • remove: when a client is closed and removed from a pool
    • pool.on('remove', (client: Client) => void) => void

License

Apache 2.0 License, please see LICENSE for details.