You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using mysql2 driver to connect MySql Database with below config
mysql.createPool({
host: process.env.NODE_MYSQL_IP,
user: process.env.MYSQL_USER,
password: decryptPassword(process.env.NODE_MYSQL_PASSWORD),
database: process.env.MYSQL_SCHEMA,
waitForConnections: true,
connectionLimit: 4, // 20 concurrent connections
maxIdle: 4, // max idle connections, the default value is the same as connectionLimit
idleTimeout: 20000, // idle connections timeout, in milliseconds, the default value 60000
queueLimit: 0
});
I am using execute method instead of query.
when i have to just perform select query then i directly use pool but when i have to start transaction then i get connection from pool and then commit and release respectively.
also i have printed free connection with all connection as below code
I am using mysql2 driver to connect MySql Database with below config
mysql.createPool({
host: process.env.NODE_MYSQL_IP,
user: process.env.MYSQL_USER,
password: decryptPassword(process.env.NODE_MYSQL_PASSWORD),
database: process.env.MYSQL_SCHEMA,
waitForConnections: true,
connectionLimit: 4, // 20 concurrent connections
maxIdle: 4, // max idle connections, the default value is the same as
connectionLimit
idleTimeout: 20000, // idle connections timeout, in milliseconds, the default value 60000
queueLimit: 0
});
I am using execute method instead of query.
when i have to just perform select query then i directly use pool but when i have to start transaction then i get connection from pool and then commit and release respectively.
also i have printed free connection with all connection as below code
const allConnections = connection.pool?._allConnections.length ?? connection.connection._pool?._allConnections.length;
const freeConnections = connection.pool?._freeConnections.length ?? connection.connection._pool?._freeConnections.length;
my allConnections become 0 after some time and then i got error as Error: Can't add new command when connection is in closed state on execute method.
please help
The text was updated successfully, but these errors were encountered: