Skip to content

Commit

Permalink
loading is not needed with zeitwerk autoloader
Browse files Browse the repository at this point in the history
This was only needed for classic autoloader.  The core "freedom" patch made zeitwerk autoloader
bypass the interlock anyway, so now that we're only supporting zeitwerk, this is no longer
needed.

Co-dependency:
ManageIQ/manageiq#22801

Part of the rails 7 upgrade: ManageIQ/manageiq#22052
  • Loading branch information
jrafanie committed Dec 4, 2023
1 parent cc89506 commit 8885e1e
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 8885e1e

Please sign in to comment.