Skip to content

api: add ConnectionHandler to the connection_pool #210

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

Merged
merged 1 commit into from
Sep 7, 2022

Conversation

oleg-jukovec
Copy link
Collaborator

@oleg-jukovec oleg-jukovec commented Aug 22, 2022

ConnectionHandler provides callbacks for components interested in handling changes of connections in a ConnectionPool.

We have to take into account that user callbacks can take an indefinite amount of time. The simplest solution is to process each connection in a separate goroutine. This should not affect to performance because most of the time these goroutines are blocked.

I didn't forget about (remove if it is not applicable):

Related issues:

Closes #178

The pull request is based on #208. You need to review only a last commit until #208 is not merged.

@oleg-jukovec oleg-jukovec marked this pull request as ready for review August 22, 2022 15:14
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-178-connection-pool-callbacks branch from 391d4e7 to 2a91428 Compare August 24, 2022 06:56
@oleg-jukovec oleg-jukovec marked this pull request as draft August 24, 2022 19:49
@oleg-jukovec
Copy link
Collaborator Author

I put it back in draft to make it easier to review and merge. It will be ready for review after #208

@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-178-connection-pool-callbacks branch 3 times, most recently from f9bad2a to 77415e3 Compare August 26, 2022 14:17
@DifferentialOrange
Copy link
Member

I put it back in draft to make it easier to review and merge

To be honest, it makes the whole situation a bit more complicated. When I see the draft, I suppose it's not ready for review.

@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-178-connection-pool-callbacks branch from 77415e3 to da2b0e5 Compare August 28, 2022 13:33
Copy link
Member

@DifferentialOrange DifferentialOrange left a comment

Choose a reason for hiding this comment

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

I'll try to make another iteration after some time

@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-178-connection-pool-callbacks branch from da2b0e5 to 8b54c9e Compare August 29, 2022 09:02
@oleg-jukovec oleg-jukovec marked this pull request as ready for review August 29, 2022 10:14
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-178-connection-pool-callbacks branch 2 times, most recently from be96977 to ebc71a6 Compare August 30, 2022 11:13
@oleg-jukovec oleg-jukovec changed the title api: add ConnectionListener to the connection_pool api: add ConnectionHandler to the connection_pool Aug 30, 2022
Copy link
Member

@DifferentialOrange DifferentialOrange left a comment

Choose a reason for hiding this comment

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

Should be LGTM after resolving this batch of comments.

@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-178-connection-pool-callbacks branch from ebc71a6 to 10e95f1 Compare September 1, 2022 09:49
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-178-connection-pool-callbacks branch from 10e95f1 to fac406e Compare September 2, 2022 07:13
ConnectionHandler provides callbacks for components interested
in handling changes of connections in a ConnectionPool.

We have to take into account that user callbacks can take an
indefinite amount of time. The simplest solution is to process each
connection in a separate goroutine. This should not affect to
performance because most of the time these goroutines are blocked.

Closes #178
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-178-connection-pool-callbacks branch from fac406e to 6dccdd5 Compare September 5, 2022 09:55
@oleg-jukovec oleg-jukovec requested review from AnaNek and removed request for AnaNek September 5, 2022 13:27
@oleg-jukovec oleg-jukovec merged commit 3d3ec70 into master Sep 7, 2022
@oleg-jukovec oleg-jukovec deleted the oleg-jukovec/gh-178-connection-pool-callbacks branch September 7, 2022 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support user-defined callbacks for connection_pool events
3 participants