Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mysql connection not release #4

Open
youyi1314 opened this issue Mar 31, 2021 · 0 comments
Open

Mysql connection not release #4

youyi1314 opened this issue Mar 31, 2021 · 0 comments

Comments

@youyi1314
Copy link

Hi,
Thanks for this ,
I use this for socket.io, but i found that the connection not release, may i know how can i release connection after used?

My code before

const db = function () {
const redisOptions = {};
        const cacheOptions = {
            expire: 2629746,// seconds, defaults to 30 days
            keyPrefix: "sql.", // default
            hashType: HashTypes.blake2b512, //default
            caching: Caching.SKIP //default
        };
        const pool = mysql.createPool({
            connectionLimit: 2,
            host: env.DB_HOST,
            user: env.DB_USERNAME,
            password: env.DB_PASSWORD,
            database: env.DB_DATABASE
        }).promise();
        const redis = asyncRedis.createClient();
        return new MysqlRedisAsync(
            pool,
            redis,
            cacheOptions
        );
}

[data, fields] = db.query('SELECT * FROM USERS');
console.log(data)

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant