File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,22 +22,24 @@ class ManifestRegistrar
2222 def initialize ( container )
2323 @container = container
2424 @config = container . config
25+ @loaded = Set . new
2526 end
2627
2728 # @api private
2829 def finalize!
29- eager_loaded = container . keys . each_with_object ( Set . new ) do |key , set |
30- set << Identifier . new ( key ) . root_key
31- end
32-
3330 ::Dir [ registrations_dir . join ( RB_GLOB ) ] . each do |file |
3431 ident = Identifier . new ( File . basename ( file , RB_EXT ) )
35- call ( ident ) unless eager_loaded . include? ( ident . root_key )
32+
33+ # Skip files already loaded during earlier stages of finalization, such as a provider
34+ # resolving a component satisfied via a manifest. Since `#call` uses `load`, re-running
35+ # here would duplicate registrations.
36+ call ( ident ) unless @loaded . include? ( ident . root_key )
3637 end
3738 end
3839
3940 # @api private
4041 def call ( component )
42+ @loaded << component . root_key
4143 load ( root . join ( config . registrations_dir , "#{ component . root_key } #{ RB_EXT } " ) )
4244 end
4345
You can’t perform that action at this time.
0 commit comments