connection_pool 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cba01c34d4f2ac4cd9beb4d71ade9808e66095a0
4
- data.tar.gz: 541e73dc97f93b16a7a2725be6157395a76b2295
3
+ metadata.gz: ec91685df50fe18b79ef2cd2ed2fb038e322ff81
4
+ data.tar.gz: 99b88e1aa01811e18c2737e8e062c4726ce54666
5
5
  SHA512:
6
- metadata.gz: d2d9e0deee042e07bd04a4715c97d67bc0c6d59fc6670a307a740024d7ff38ad6fe46dbe9edc482bdef7d6ed51abaeb5297df1a3664c6ec26ba0f2d0e51512c7
7
- data.tar.gz: 2dbf1090f068f706141e92aae4dfefb1f596e96be621e0ad1d4e4824c9abae734f337d7ea2e4c5d7943f612835f4ca429469347f1270359c4e604033329dabc4
6
+ metadata.gz: 53d34f8ca6a7d51ce535a83e2821dd33eb15a623df3022b89775c232876c8fec28a2b33adda24248136014d99f0ebe9f09c1f49e1f0ced76435db26538e907a7
7
+ data.tar.gz: 660f22d0f828c789942da1da3d7c4131e008dd383a83c74e59ea03f306a59b966e879d42f9704ffa3b7de6accb6c114cfff982d3343bbe34c5e60ecc8f705ac5
data/Changes.md CHANGED
@@ -1,3 +1,9 @@
1
+ 2.1.3
2
+ ------
3
+
4
+ - Don't increment created count until connection is successfully
5
+ created. [mylesmegyesi, #73]
6
+
1
7
  2.1.2
2
8
  ------
3
9
 
@@ -188,8 +188,9 @@ class ConnectionPool::TimedStack
188
188
 
189
189
  def try_create(options = nil)
190
190
  unless @created == @max
191
+ object = @create_block.call
191
192
  @created += 1
192
- @create_block.call
193
+ object
193
194
  end
194
195
  end
195
196
  end
@@ -1,3 +1,3 @@
1
1
  class ConnectionPool
2
- VERSION = "2.1.2"
2
+ VERSION = "2.1.3"
3
3
  end
@@ -34,6 +34,25 @@ class TestConnectionPoolTimedStack < Minitest::Test
34
34
  assert_equal 1, stack.length
35
35
  end
36
36
 
37
+ def test_object_creation_fails
38
+ stack = ConnectionPool::TimedStack.new(2) { raise 'failure' }
39
+
40
+ begin
41
+ stack.pop
42
+ rescue => error
43
+ assert_equal 'failure', error.message
44
+ end
45
+
46
+ begin
47
+ stack.pop
48
+ rescue => error
49
+ assert_equal 'failure', error.message
50
+ end
51
+
52
+ refute_empty stack
53
+ assert_equal 2, stack.length
54
+ end
55
+
37
56
  def test_pop
38
57
  object = Object.new
39
58
  @stack.push object
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: connection_pool
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-02 00:00:00.000000000 Z
12
+ date: 2015-03-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler