chore: use after_connect hook within connection pool for each new connection #186
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.
Motivation
Use
after_connect
hook in the proper way with each connection within the connection pool (sequel doc)Actual behavior
Currently, there is
after_connect
executed only once for the Sequel connection instance, but it's not executed when creating new connection within connection poolIssue
With using sequel-rails with rails and multithreaded webserver (for example Puma) there is a need to utilize a connection pool for multiple connections.
Let's say that we want to set statement_timeout for all connections in the connection pool.
So with max_connections => 5 and running
there should be the same timeout -> 30s for all connections in the connection pool
@JonathanTron @JosephHalter
Could you please take a look at that to verify all the changes? :)