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

[WIP] Add LazyConnectionPool #148

Open
wants to merge 4 commits into
base: 0.7.x
Choose a base branch
from

Conversation

skydiablo
Copy link

this allow to fire up multiple querys at a time so that long-running query will not block you unique database connection point.

@WyriHaximus WyriHaximus added this to the v0.6.0 milestone Dec 4, 2021
@clue clue changed the title Add LazyConnectionPool [WIP] Add LazyConnectionPool Jan 31, 2022
@clue clue removed this from the v0.6.0 milestone Jan 31, 2022
Copy link
Contributor

@clue clue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skydiablo Thank you for looking into this, like the direction this is taking!

I've also started looking into this a while back and came up with a somewhat similar structure (https://twitter.com/another_clue/status/1419633478216388612), but never quite finished this into a full PR. Implementing this as a decorator around the existing (lazy) connection makes a lot of sense and probably covers 80% of the use cases just fine! It also looks like #147 could be good starting point to simplify the API somewhat in the future.

However, it's easy to come up with use cases that break this abstraction, in particular when using transactions that probably shouldn't span multiple independent connections.

I wonder if we can use this as a base to build a proper test suite to cover most common use cases and work out an API that also takes care of the more nuanced subtleties when it comes to connection reuse for stateful properties such as the transaction state.

In either case, I'm curious what this is going to evolve into, so keep it up! 👍

@skydiablo
Copy link
Author

yes, the transaction handling will be a new challenge. maybe this lib can give an opportunity for this feature? my basic think, i can borrow an connection and if i will be finished (transaction done), i can get back the connection to the pool?

@clue
Copy link
Contributor

clue commented Feb 3, 2022

@skydiablo Sounds good to me, see also https://github.com/mysqljs/mysql#pooling-connections. Let's also ping @szado and see if we can integrate some similar logic into this repository 👍

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

Successfully merging this pull request may close these issues.

3 participants