diff --git a/lib/api/environment.rb b/lib/api/environment.rb index c9487541ab..87b34f99ee 100644 --- a/lib/api/environment.rb +++ b/lib/api/environment.rb @@ -17,7 +17,12 @@ def self.encrypted_attributes 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 = cspec[:klass].constantize + klass = nil + + # Temporary measure to avoid thread race condition which could lead to a deadlock + ActiveSupport::Dependencies.interlock.permit_concurrent_loads do + klass = cspec[:klass].constantize + end klass.columns_hash.each do |name, typeobj| result << name if %w(date datetime).include?(typeobj.type.to_s) end