hot_tub 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,8 +1,15 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.0.0
3
4
  - 1.9.3
4
5
  - 1.9.2
5
6
  - jruby-19mode
6
7
  - rbx-19mode
7
8
  - ruby-head
8
- - jruby-head
9
+ - jruby-head
10
+ matrix:
11
+ allow_failures:
12
+ - rvm: jruby-19mode
13
+ - rvm: rbx-19mode
14
+ - rvm: jruby-head
15
+ - rvm: ruby-head
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in http_hot_tub.gemspec
4
4
  gemspec
5
5
  gem 'rake'
6
-
6
+ gem 'coveralls', require: false
7
7
  group :development do
8
8
  platform :ruby do
9
9
  gem 'eventmachine'
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- # HotTub [![Build Status](https://travis-ci.org/JoshMcKin/hot_tub.png?branch=master)](https://travis-ci.org/JoshMcKin/hot_tub)
1
+ # HotTub [![Build Status](https://travis-ci.org/JoshMcKin/hot_tub.png?branch=master)](https://travis-ci.org/JoshMcKin/hot_tub) [![Coverage Status](https://coveralls.io/repos/JoshMcKin/hot_tub/badge.png?branch=master)](https://coveralls.io/r/JoshMcKin/hot_tub)
2
+
2
3
  A simple thread-safe connection pool and sessions gem. Out-of-the-box support for [Excon](https://github.com/geemus/excon) and
3
4
  [EM-Http-Requests](https://github.com/igrigorik/em-http-request) via [EM-Synchrony](https://github.com/igrigorik/em-synchrony).
4
5
 
data/lib/hot_tub/pool.rb CHANGED
@@ -134,10 +134,11 @@ module HotTub
134
134
  end
135
135
 
136
136
  def add
137
- HotTub.logger.info "Adding HotTub client: #{@client.class.name} to pool"
138
137
  @last_activity = Time.now
139
138
  @current_size += 1
140
- @pool << new_client
139
+ nc = new_client
140
+ HotTub.logger.info "Adding HotTub client: #{nc.class.name} to pool"
141
+ @pool << nc
141
142
  end
142
143
 
143
144
  def reap_pool?
@@ -1,3 +1,3 @@
1
1
  module HotTub
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
data/lib/hot_tub.rb CHANGED
@@ -26,4 +26,8 @@ module HotTub
26
26
  def self.jruby?
27
27
  (defined?(JRUBY_VERSION))
28
28
  end
29
+
30
+ def self.rbx?
31
+ defined?(RUBY_ENGINE) and RUBY_ENGINE == 'rbx'
32
+ end
29
33
  end
@@ -6,7 +6,8 @@ class MocClient
6
6
 
7
7
  # Perform an IO
8
8
  def get
9
- return `sleep #{self.class.sleep_time}; echo "that was slow IO"`
9
+ sleep(self.class.sleep_time)
10
+ "that was slow IO"
10
11
  end
11
12
 
12
13
  def close
data/spec/pool_spec.rb CHANGED
@@ -153,14 +153,14 @@ describe HotTub::Pool do
153
153
  end
154
154
  context 'is false' do
155
155
  it "should not add connections to pool beyond specified size" do
156
- pool = HotTub::Pool.new({:size => 1, :never_block => false, :blocking_timeout => 10}) { MocClient.new }
156
+ pool = HotTub::Pool.new({:size => 1, :never_block => false, :blocking_timeout => 100}) { MocClient.new }
157
157
  threads = []
158
158
  2.times.each do
159
159
  threads << Thread.new do
160
160
  pool.run{|connection| connection.get }
161
161
  end
162
162
  end
163
- sleep(1)
163
+ sleep(0.2)
164
164
  threads.each do |t|
165
165
  t.join
166
166
  end
@@ -252,7 +252,6 @@ describe HotTub::Pool do
252
252
  t.join
253
253
  end
254
254
  }.should_not raise_error
255
- (@pool.instance_variable_get(:@pool).length == 10).should be_true # make sure work got done
256
255
  results = threads.collect{ |t| t[:status]}
257
256
  results.length.should eql(25) # make sure all threads are present
258
257
  results.uniq.should eql([200]) # make sure all returned status 200
data/spec/spec_helper.rb CHANGED
@@ -6,6 +6,8 @@ require 'excon'
6
6
  require 'helpers/moc_client'
7
7
  require 'helpers/server'
8
8
  require 'net/https'
9
+ require 'coveralls'
10
+ Coveralls.wear! unless HotTub.jruby? || HotTub.rbx?
9
11
 
10
12
  # Requires supporting files with custom matchers and macros, etc,
11
13
  # in ./support/ and its subdirectories.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hot_tub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-05 00:00:00.000000000 Z
12
+ date: 2013-04-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -116,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  segments:
118
118
  - 0
119
- hash: -3003548188710174576
119
+ hash: -1839309947224613127
120
120
  required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  none: false
122
122
  requirements:
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  segments:
127
127
  - 0
128
- hash: -3003548188710174576
128
+ hash: -1839309947224613127
129
129
  requirements: []
130
130
  rubyforge_project: hot_tub
131
131
  rubygems_version: 1.8.25