-
Notifications
You must be signed in to change notification settings - Fork 417
Add connection_holder_class to Pool for custom connection handling #1251
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
base: master
Are you sure you want to change the base?
Add connection_holder_class to Pool for custom connection handling #1251
Conversation
4a5d365
to
fbd1ef2
Compare
…agicStack#1251 Introduces a `connection_holder_class` parameter to the `Pool` class, enabling the use of custom classes for managing individual connections. This provides more flexibility for handling connection lifecycle, including acquisition and release logic, tailored to specific use cases.
fbd1ef2
to
daa3d96
Compare
If you consider the behavior described in #989 to be a bug in connection management, I also have a modified version of PoolConnectionHolder that addresses it. This version ensures that connections are not closed below min_size, even in cases where the database drops the connection. I'm happy to submit it as a separate PR if there's interest. |
Great, I also consider the current behavior to be a bug. In that case, I suggest we fix it as part of this PR — I'll update it a bit later to include the improved |
I would prefer if we separated the fix into a standalone PR.
|
@elprans, I understand your concerns about making Regarding the idea of adding a separate policy, callback, or something similar, I’ll consider it, but it seems that this would only add extra complexity due to the additional layer of abstraction. |
This PR introduces the
connection_holder_class
parameter to thePool
class, enabling developers to plug in custom logic for managing individual connections — including acquisition, release, and lifecycle control. This added flexibility is particularly useful for advanced or non-standard use cases where the default connection handling may be insufficient.The change also lays the groundwork for addressing issue #989 by making it possible to implement custom connection management strategies tailored to specific requirements.