Jump to content

MySQL2 problem work with pools


Recommended Posts

Posted

Hello!

Forgive me if I wrote in the wrong place.

Faced a problem: Quite a long time answer when dealing with mysql2 pools.

At the same time, if I work through createConnection, everything is fine, the answer is quick.

What could be? The answer to such a request comes after 3 seconds . Or if I work without pools, then I get the answer in the same second.

 

// Connect

mp.db = await require("mysql2").createPool({
  connectionLimit: config.connectionLimit,
  host: config.host,
  user: config.user,
  password: config.password,
  database: config.database
});

// Query

mp.db.query(`SELECT * FROM test WHERE username = '${player.name}'`, function (error, result, fields) {
  if (error) return mp.dbError('authPlayer', error, authPlayer(player));
  if (result.length > 0) {
    player.call(`createWindow`, ['auth']);
    return true;
  }
  player.call(`createWindow`, ['register']);
});

 

  • 2 weeks later...
Posted

The problem was with the Ubuntu version.

Found the reason by chance. The server was started on 16.04 - there was a problem. Updated to 18.04 - the problem remains.

But with Ubuntu 20.04, the problem disappeared.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...