mirror of
https://github.com/internetee/registry.git
synced 2025-05-21 03:39:40 +02:00
Story#108602614 - one more speed optimization
This commit is contained in:
parent
f02ebe5559
commit
34aa3c0741
3 changed files with 8 additions and 2 deletions
|
@ -30,5 +30,11 @@ module Legacy
|
||||||
@new_registrar_cache ||= {}
|
@new_registrar_cache ||= {}
|
||||||
@new_registrar_cache[old_id] ||= ::Registrar.select(:id).find_by(legacy_id: old_id)
|
@new_registrar_cache[old_id] ||= ::Registrar.select(:id).find_by(legacy_id: old_id)
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -55,7 +55,7 @@ module Legacy
|
||||||
def user
|
def user
|
||||||
@user ||= begin
|
@user ||= begin
|
||||||
obj_his = Legacy::ObjectHistory.find_by(historyid: historyid)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace :import do
|
||||||
end
|
end
|
||||||
next if changes.blank? && event != :destroy
|
next if changes.blank? && event != :destroy
|
||||||
obj_his = Legacy::ObjectHistory.find_by(historyid: responder.historyid)
|
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 = {
|
hash = {
|
||||||
item_type: Contact.to_s,
|
item_type: Contact.to_s,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue