Skip to content

Commit b68cc94

Browse files
Merge pull request rails#49447 from jonathanhefner/message_pack-fix-rails_max_threads
Fix `AS::MessagePack` with `ENV["RAILS_MAX_THREADS"]`
2 parents 0ba14eb + bb8ad69 commit b68cc94

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

activesupport/lib/active_support/message_pack/serializer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def message_pack_pool
5151
install_unregistered_type_handler
5252
message_pack_factory.freeze
5353
end
54-
message_pack_factory.pool(ENV.fetch("RAILS_MAX_THREADS") { 5 })
54+
message_pack_factory.pool(ENV.fetch("RAILS_MAX_THREADS", 5).to_i)
5555
end
5656
end
5757

activesupport/test/message_pack/shared_serializer_tests.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,15 @@ module MessagePackSharedSerializerTests
140140
test "roundtrips ActiveSupport::HashWithIndifferentAccess" do
141141
assert_roundtrip ActiveSupport::HashWithIndifferentAccess.new(a: true, b: 2, c: "three")
142142
end
143+
144+
test "works with ENV['RAILS_MAX_THREADS']" do
145+
original_env = ENV.to_h
146+
ENV["RAILS_MAX_THREADS"] = "1"
147+
148+
assert_roundtrip "value"
149+
ensure
150+
ENV.replace(original_env)
151+
end
143152
end
144153

145154
private

0 commit comments

Comments
 (0)