We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 335c8b6 commit 6f93985Copy full SHA for 6f93985
lib/resque/connection_pool.rb
@@ -30,7 +30,7 @@ def with_connection
30
conn = checkout
31
yield(conn)
32
ensure
33
- checkin(conn)
+ checkin(conn) if conn
34
end
35
36
private
test/connection_pool_test.rb
@@ -2,6 +2,18 @@
2
3
module Resque
4
describe ConnectionPool do
5
+ it "with_conneciton does not deadlock on checkout exceptions" do
6
+ cp = Class.new(ConnectionPool) {
7
+ def checkout
8
+ raise "omg"
9
+ end
10
+ }.new(REDIS_URL, 5)
11
+ e = assert_raises(RuntimeError) do
12
+ cp.with_connection { }
13
14
+ assert_equal 'omg', e.message
15
16
+
17
it "takes a URL" do
18
cp = ConnectionPool.new(REDIS_URL, 5)
19
assert_equal 5, cp.size
0 commit comments