Skip to content

Commit

Permalink
Make sure that concurrent map usage is thread-safe
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mensfeld authored Nov 20, 2022
1 parent 2497eb0 commit 9a77b0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion actionview/lib/action_view/renderer/abstract_renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def render

module ObjectRendering # :nodoc:
PREFIXED_PARTIAL_NAMES = Concurrent::Map.new do |h, k|
h[k] = Concurrent::Map.new
h.compute_if_absent(k) { Concurrent::Map.new }
end

def initialize(lookup_context, options)
Expand Down

0 comments on commit 9a77b0f

Please sign in to comment.