promise-mysql pool: release connection back to pool
Closed this issue · 2 comments
When performing queries, getPool()
is used to get the pool which contains connections, which then again can be used to perform a query. This can for example be seen here https://github.com/chrisleekr/nodejs-vuejs-mysql-boilerplate/blob/ad489f7b34d60aef21d274434a1419e38dc21dfc/api/app/helpers/database.js. When the queries are completed in this file there is no call to the release()
function, which is supposed to return the connection back to the pool.
Hi @DiiBBz
Yap, you are right. I will fix up when I get time.
With some further digging it seems like I was incorrect. From the documentation on github for promise-mysql
it says pool.query: Get a connection from the pool, run a query and then release it back into the pool.
. Using query is therefore totally valid. If however several queries are to be performed getConnection
should be used with release
to give the connection back to the pool .
I therefore think this issue is resolved, as it actually never really was an issue.