Skip to content

Commit 9a77b0f

Browse files
authored
Make sure that concurrent map usage is thread-safe
Behavior upon missing prefix partial name may cause a key to overwrite when executed in multiple threads at the same time. ref ruby-concurrency/concurrent-ruby#970
1 parent 2497eb0 commit 9a77b0f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

actionview/lib/action_view/renderer/abstract_renderer.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def render
3131

3232
module ObjectRendering # :nodoc:
3333
PREFIXED_PARTIAL_NAMES = Concurrent::Map.new do |h, k|
34-
h[k] = Concurrent::Map.new
34+
h.compute_if_absent(k) { Concurrent::Map.new }
3535
end
3636

3737
def initialize(lookup_context, options)

0 commit comments

Comments
 (0)