Git Product home page Git Product logo

Comments (4)

cvburgess avatar cvburgess commented on June 1, 2024

Do you not use a database with pooling? Managing your own connections is usually not recommended. You can configure pooling in the knex config object.

from sqldatasource.

cvburgess avatar cvburgess commented on June 1, 2024

Also it looks like you are using an older version of this lib. In v1 the format is different which may explain it not connecting. Check out the readme for more information!

from sqldatasource.

sesteva avatar sesteva commented on June 1, 2024

I'm using this with oracledb and it looks like the pool connection keeps the event loop busy and so the process does not exit.
I'm especially concern about this as I will be executing within an AWS lambda.
After discussing with the guys behind oracledb module, I was suggested to close the pool when the SIGTERM/SIGINT signals are issued.

I do this where I create the datasources.

const Clients = require("./clients");
const OracleAnalytics = require("./oracle-analytics");

const Oracle = new OracleAnalytics();

const dataSources = () => ({
  clients: new Clients(),
  oracleAnalytics: Oracle
});

module.exports = dataSources;

async function closePoolAndExit() {
  try {
    await Oracle.db.destroy();
    console.log("Pool closed");
    process.exit(0);
  } catch (err) {
    console.error(err.message);
    process.exit(1);
  }
}

process.once("SIGTERM", closePoolAndExit).once("SIGINT", closePoolAndExit);

Here is the thread about oracledb Github Thread

from sqldatasource.

cvburgess avatar cvburgess commented on June 1, 2024

Note, please use the KNEX documentation for pooling, this is merely a thin wrapper on top of KNEX.

from sqldatasource.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.