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 +8 -1
- data/Gemfile +1 -1
- data/README.md +2 -1
- data/lib/hot_tub/pool.rb +3 -2
- data/lib/hot_tub/version.rb +1 -1
- data/lib/hot_tub.rb +4 -0
- data/spec/helpers/moc_client.rb +2 -1
- data/spec/pool_spec.rb +2 -3
- data/spec/spec_helper.rb +2 -0
- metadata +4 -4
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
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
|
-
|
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?
|
data/lib/hot_tub/version.rb
CHANGED
data/lib/hot_tub.rb
CHANGED
data/spec/helpers/moc_client.rb
CHANGED
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 =>
|
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(
|
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
|
+
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-
|
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: -
|
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: -
|
128
|
+
hash: -1839309947224613127
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project: hot_tub
|
131
131
|
rubygems_version: 1.8.25
|