Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loading is not needed with zeitwerk autoloader #1243

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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