SequlizeJS connection get timeout frequently

Viewed 21592

We have a project backend running on NodeJS / expressJS / SequilizeJS as a RESTapi. That RESTapi connceted to a VueJS SPA.

Only 5 people use this system. Most of the operations are transactions.

We get an error

SequelizeConnectionAcquireTimeoutError: Operation timeout

This is our config object.

const sequelize = new Sequelize(
  config.database,
  config.username,
  config.password,
  {
    host: config.host,
    dialect: "mysql",
    pool: {
      max: 20,
      min: 0,
      acquire: 30000,
      idle: 10000
    }
  }
);

We are certain that our server's memory is not the issue. Because only 5 percent is used.

Where does this error comes from?

2 Answers

Change acquire to 60000, It will resolve otherwise you need to recheck that particular query where it is coming. acquire: 60000

May be you are using trasaction in your query if yes use async await rather then .then function may is will resolved if resolved please reply in this post

Related