Story#108602614 - one more speed optimization

This commit is contained in:
Vladimir Krylov 2016-01-07 09:20:24 +02:00
parent f02ebe5559
commit 34aa3c0741
3 changed files with 8 additions and 2 deletions

View file

@ -30,5 +30,11 @@ module Legacy
@new_registrar_cache ||= {}
@new_registrar_cache[old_id] ||= ::Registrar.select(:id).find_by(legacy_id: old_id)
end
def self.new_api_user_cached old_id
@new_api_user_cache ||= {}
@new_api_user_cache[old_id] ||= Legacy::Domain.new_registrar_cached(old_id).try(:api_users).try(:first)
end
end
end

View file

@ -55,7 +55,7 @@ module Legacy
def user
@user ||= begin
obj_his = Legacy::ObjectHistory.find_by(historyid: historyid)
Legacy::Domain.new_registrar_cached(obj_his.upid || obj_his.clid).try(:api_users).try(:first)
Legacy::Domain.new_api_user_cached(obj_his.upid || obj_his.clid)
end
end

View file

@ -57,7 +57,7 @@ namespace :import do
end
next if changes.blank? && event != :destroy
obj_his = Legacy::ObjectHistory.find_by(historyid: responder.historyid)
user = Legacy::Domain.new_registrar_cached(obj_his.upid || obj_his.clid).try(:api_users).try(:first)
user = Legacy::Domain.new_api_user_cached(obj_his.upid || obj_his.clid)
hash = {
item_type: Contact.to_s,