Open mperham opened 12 years ago
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.
:+1:
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:
This creates 5 connections which are shared by all threads.