Skip to content

Commit

Permalink
Merge pull request #1243 from jrafanie/drop_as_dependencies_interlock…
Browse files Browse the repository at this point in the history
…_with_classic_autoloader_gone

loading is not needed with zeitwerk autoloader

(cherry picked from commit 83a495d)
  • Loading branch information
Fryguy committed Jan 5, 2024
1 parent 181397c commit f3ab4b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
8 changes: 2 additions & 6 deletions app/controllers/api/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,11 @@ def provider_options(type)
end

def permitted_subclasses
ActiveSupport::Dependencies.interlock.loading do
ManageIQ::Providers::BaseManager.permitted_subclasses
end
ManageIQ::Providers::BaseManager.permitted_subclasses
end

def supported_types_for_create
ActiveSupport::Dependencies.interlock.loading do
ExtManagementSystem.supported_types_for_create
end
ExtManagementSystem.supported_types_for_create
end

def providers_options
Expand Down
12 changes: 4 additions & 8 deletions lib/api/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,10 @@ def self.encrypted_attributes_whitelist
def self.time_attributes
@time_attributes ||= ApiConfig.collections.each.with_object(Set.new(%w(expires_on))) do |(_, cspec), result|
next if cspec[:klass].blank?
klass = nil

# Ensure we're the only thread trying to autoload classes and their columns
ActiveSupport::Dependencies.interlock.loading do
klass = cspec[:klass].constantize
klass.columns_hash.each do |name, typeobj|
result << name if %w(date datetime).include?(typeobj.type.to_s)
end

klass = cspec[:klass].constantize
klass.columns_hash.each do |name, typeobj|
result << name if %w(date datetime).include?(typeobj.type.to_s)
end
end
end
Expand Down

0 comments on commit f3ab4b3

Please sign in to comment.