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

Reuse http client #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

harmingcola
Copy link

…troying on ConnectException to avoid thread leak

I've been your library for a few months now and it works brilliantly (thanks)

However, we'd a network blip yesterday and it started causing ExecutionExeptions in the HttpClient causing a thread leak. Having a look at your code, it appears the client isn't releasing threads when exceptions occur. I'm fairly sure this PR fixes the issue ..

@martijndwars
Copy link
Member

I've been your library for a few months now and it works brilliantly (thanks)

Happy to hear! You're welcome.

However, we'd a network blip yesterday and it started causing ExecutionExeptions in the HttpClient causing a thread leak. Having a look at your code, it appears the client isn't releasing threads when exceptions occur. I'm fairly sure this PR fixes the issue ..

I'll run some tests over the weekend and merge it if there are no problems. Your contribution is much appreciated!

@harmingcola
Copy link
Author

harmingcola commented Jul 12, 2018 via email

@martijndwars
Copy link
Member

martijndwars commented Jul 12, 2018

I suppose the big change that your PR introduces is that it re-uses a single HTTP client instead of creating one for each request. If you send many notifications in async, then creating a new HTTP client will waste a lot of resources. Is that correct?

@harmingcola
Copy link
Author

harmingcola commented Jul 16, 2018 via email

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.

2 participants