add automatic connection release with Symbol.asyncDispose after execu…#3590
add automatic connection release with Symbol.asyncDispose after execu…#3590luiz-rissardi wants to merge 1 commit intosidorares:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3590 +/- ##
==========================================
- Coverage 89.08% 89.06% -0.03%
==========================================
Files 86 86
Lines 13538 13544 +6
Branches 1569 1569
==========================================
+ Hits 12061 12063 +2
- Misses 1477 1481 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
What could I do? I didn't understand why the errors were occurring, where could I put this change to release a connection after a query? |
Hi, @luiz-rissardi! Firstly, thank you for your contribution 🙋🏻♂️ Regarding the error returned, it's due to the lint check (Prettier). You can fix it running the command About the changes, the import mysql from 'mysql2/promise';
const pool = mysql.createPool('mysql://root:password@localhost:3306/test');
const connection = await pool.getConnection();
// ... some queries
connection.release();You can check out the detailed documentation and examples at docs/examples/connections/create-pool and docs/examples/connections/createPoolCluster. I'm attempting to visualize the scenarios. Is this feature related to the new In this case, I believe it makes more sense to adopt this approach to close connections. What do you think? |
|
Primeiramente, obrigado a me ajudar na comunidade open source, essa é minha primeira vez tentando agir diretamente em uma biblioteca, a minha sugestão para as próximas versões seria implementar a liberação das conexões de createPool e createConnection automaticamente, sem a necessidade do .end() ou o .release(). |
You're welcome, @luiz-rissardi! I can also talk in Portuguese, but I'll continue talking in English here. Feel free to contact me directly if you prefer in Portuguese only. As I haven't tested the possible conflicts, I'd like to understand if |
|
@wellwelwel teria que ver se ele realmente está afetando os testes, eu não encontrei o motivo de tantos testes quebrarem |
|
Alguém conseguiu ver o porque dos testes terem dado errado? não tive muito tempo pra ver essa feature no projeto, de implementar o uso das novas "using" do javascript |
@luiz-rissardi, you can check the solution for the failed workflow in #3590 (comment) and about implementation (also for tests implementation based in Node.js version) in #3590 (comment). Feel free to ask if you have any questions 🙋🏻♂️ |
|
🇺🇸 Hey @luiz-rissardi, if you can't follow the conversation in English, feel free to call me on LinkedIn and chat in Portuguese 🤝 🇧🇷 Fala @luiz-rissardi, se você não puder seguir a conversa em inglês, fique à vontade para me chamar no LinkedIn e conversar em português 🤝 |
|
Hi @luiz-rissardi @wellwelwel , Is there any update on this PR? If you'd like, I can take this over and open a new PR. |
@sakurai-ryo, in this PR, the implementation is in the wrong place ( |
|
@wellwelwel |
|
Closing in favor of #4112. |
ADD: automatic connection release with Symbol.asyncDispose after execution