Allow to specify custom connection reset query builder#1146
Closed
dsav wants to merge 1 commit intoMagicStack:masterfrom
Closed
Allow to specify custom connection reset query builder#1146dsav wants to merge 1 commit intoMagicStack:masterfrom
dsav wants to merge 1 commit intoMagicStack:masterfrom
Conversation
The default connection reset behaviour might be an overkill for some cases e.g. when respective server capabilities are not used or resources are cleaned up explicitly before returning the connection to the pool. This provides an opt-in way to override this default behaviour. Also see MagicStack#780
elprans
added a commit
that referenced
this pull request
Oct 18, 2024
A coroutine can be passed to the new `reset` argument of `create_pool` to control what happens to the connection when it is returned back to the pool by `release()`. By default `Connection.reset()` is called. Additionally, `Connection.get_reset_query` is renamed from `Connection._get_reset_query` to enable an alternative way of customizing the reset process via subclassing. Closes: #780 Closes: #1146
Member
|
I ended up taking a slightly different approach in #1191. |
elprans
added a commit
that referenced
this pull request
Oct 18, 2024
A coroutine can be passed to the new `reset` argument of `create_pool` to control what happens to the connection when it is returned back to the pool by `release()`. By default `Connection.reset()` is called. Additionally, `Connection.get_reset_query` is renamed from `Connection._get_reset_query` to enable an alternative way of customizing the reset process via subclassing. Closes: #780 Closes: #1146
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The default connection reset behaviour might be an overkill for some cases e.g. when respective server capabilities are not used or resources are cleaned up explicitly before returning the connection to the pool.
This provides an opt-in way to override this default behaviour.
Also see #780