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

Not thread-safe #25

Open
mperham opened this issue Oct 5, 2012 · 1 comment
Open

Not thread-safe #25

mperham opened this issue Oct 5, 2012 · 1 comment

Comments

@mperham
Copy link

mperham commented Oct 5, 2012

Storing the connection at the class-level means that all threads try to use the same Net::HTTP instance concurrently. I was able to make the gem thread-safe by changing one line to use a connection pool from the connection_pool gem:

@connection = ConnectionPool::Wrapper.new(:size => 5) { Connection.new(self) }

This creates 5 connections which are shared by all threads.

@elia
Copy link

elia commented Jan 29, 2013

👍

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

No branches or pull requests

2 participants