node-q-pool

The `node-q` module seems to be losing its connection or for some reason returning `undefined` from queries after a random amount of time. This goes away when the server is restarted. This is a workaround that creates a pool with new connections every 3

Usage no npm install needed!

<script type="module">
  import nodeQPool from 'https://cdn.skypack.dev/node-q-pool';
</script>

README

The node-q module seems to be losing its connection or for some reason returning undefined from queries after a random amount of time. This goes away when the server is restarted. This is a workaround that creates a pool with new connections every 30 seconds, so there can't be any stale connections that don't work.

Supports k for querying with a connection it from a pool. Also handles ks (without parameters).

var qpool = require('node-q-pool');

qpool.getConnection({{host: "localhost", port: 5000}, function(err, con) {
  if (err) throw err;
  con.k("sum 1 2 3", function(err, res) {
    if (err) throw err;
    console.log("result", res); // 6
  });
});