We are getting Knex timeout error mostly during high traffic in production with postgresql database. The knex config is as follows:

module.exports = {
  client: 'pg',
  connection: 
    process.env.DATABASE_URL || {
      host: process.env.DB_HOST,
      port: process.env.DB_PORT,
      user: process.env.DB_USER,
      password: process.env.DB_PASSWORD,
      database: process.env.DB_NAME
    },
  migrations: {
    directory: './migrations'
  },
  seeds: {
    directory: './seeds'
  },
  pool: {
    min: 0,
    max: 20
  }
};

We tried removing transactions from 2 heavy controllers and somehow optimized queries up to a point. But we are still getting this issue. We are using node 14. and following are the version of related dependencies

"knex": "^2.1.0",
"objection": "^3.0.0",
"pg": "^8.6.0"
0

There are 0 best solutions below