Skip to content

Commit 26922bd

Browse files
committed
fix: Rollback default change, fixes #200
1 parent 6a76a6a commit 26922bd

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

Changes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# connection_pool Changelog
22

3+
2.5.2
4+
------
5+
6+
- Rollback inadvertant change to `auto_reload_after_fork` default. [#200]
7+
38
2.5.1
49
------
510

lib/connection_pool.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class TimeoutError < ::Timeout::Error; end
3939
# - :auto_reload_after_fork - automatically drop all connections after fork, defaults to true
4040
#
4141
class ConnectionPool
42-
DEFAULTS = {size: 5, timeout: 5, auto_reload_after_fork: false}.freeze
42+
DEFAULTS = {size: 5, timeout: 5, auto_reload_after_fork: true}.freeze
4343

4444
def self.wrap(options, &block)
4545
Wrapper.new(options, &block)

lib/connection_pool/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
class ConnectionPool
2-
VERSION = "2.5.1"
2+
VERSION = "2.5.2"
33
end

test/test_connection_pool.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,4 +706,29 @@ def test_automatic_after_fork_callback
706706
_, status = Process.waitpid2(pid)
707707
assert_predicate(status, :success?)
708708
end
709+
710+
def test_ractors
711+
begin
712+
# TODO Ractor prints a bunch of warnings to the console, no idea
713+
# how to turn it off
714+
r = Ractor.new do
715+
ConnectionPool.new(auto_reload_after_fork: true) { Object.new }
716+
true
717+
end
718+
r.take
719+
# should not get here
720+
refute true
721+
rescue Ractor::RemoteError => re
722+
# expected
723+
assert re.cause
724+
assert_equal Ractor::IsolationError, re.cause.class
725+
assert_match(/ConnectionPool::INSTANCES/, re.cause.message)
726+
end
727+
728+
r = Ractor.new do
729+
ConnectionPool.new(auto_reload_after_fork: false) { Object.new }
730+
true
731+
end
732+
assert_equal true, r.take
733+
end
709734
end

0 commit comments

Comments
 (0)