anibalcucco / basecamp-wrapper

Using the Basecamp API with Ruby
Apache License 2.0
76 stars 29 forks source link

Not thread-safe #25

Open mperham opened 12 years ago

mperham commented 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.

elia commented 11 years ago

:+1: