Skip to content

Commit

Permalink
Remove skeletal_manager_uuids as we do not need it
Browse files Browse the repository at this point in the history
Remove skeletal_manager_uuids as we do not need it
  • Loading branch information
Ladas committed Jan 31, 2018
1 parent b2cb0cf commit 5e057e5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
9 changes: 4 additions & 5 deletions app/models/manager_refresh/inventory_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class InventoryCollection
:internal_attributes, :delete_method, :dependency_attributes, :manager_ref, :create_only,
:association, :complete, :update_only, :transitive_dependency_attributes, :check_changed, :arel,
:inventory_object_attributes, :name, :saver_strategy, :manager_uuids, :builder_params,
:skeletal_manager_uuids, :targeted_arel, :targeted, :manager_ref_allowed_nil, :use_ar_object,
:targeted_arel, :targeted, :manager_ref_allowed_nil, :use_ar_object,
:created_records, :updated_records, :deleted_records,
:custom_reconnect_block, :batch_extra_attributes, :references_storage

Expand Down Expand Up @@ -402,7 +402,6 @@ def initialize(model_class: nil, manager_ref: nil, association: nil, parent: nil
@manager_uuids = Set.new.merge(manager_uuids)
@all_manager_uuids = all_manager_uuids
@parent_inventory_collections = parent_inventory_collections
@skeletal_manager_uuids = Set.new.merge(manager_uuids)
@targeted_arel = targeted_arel
@targeted = !!targeted

Expand Down Expand Up @@ -528,7 +527,7 @@ def object_index_with_keys(keys, record)
def noop?
# If this InventoryCollection doesn't do anything. it can easily happen for targeted/batched strategies.
if targeted?
if parent_inventory_collections.nil? && manager_uuids.blank? && skeletal_manager_uuids.blank? &&
if parent_inventory_collections.nil? && manager_uuids.blank? &&
all_manager_uuids.nil? && parent_inventory_collections.blank? && custom_save_block.nil? &&
skeletal_primary_index.blank?
# It's a noop Parent targeted InventoryCollection
Expand Down Expand Up @@ -751,12 +750,12 @@ def db_collection_for_comparison
targeted_arel.call(self)
elsif manager_ref.count > 1
# TODO(lsmola) optimize with ApplicationRecordIterator
hashes = extract_references(manager_uuids + skeletal_manager_uuids)
hashes = extract_references(manager_uuids)
full_collection_for_comparison.where(build_multi_selection_condition(hashes))
else
ManagerRefresh::ApplicationRecordIterator.new(
:inventory_collection => self,
:manager_uuids_set => (manager_uuids + skeletal_manager_uuids).to_a.flatten.compact
:manager_uuids_set => manager_uuids.to_a.flatten.compact
)
end
else
Expand Down
1 change: 0 additions & 1 deletion app/models/manager_refresh/inventory_collection/scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def scan!(inventory_collections)
:parent_inventory_collections,
:parent_inventory_collections=,
:references,
:skeletal_manager_uuids,
:transitive_dependency_attributes,
:to => :inventory_collection

Expand Down
4 changes: 0 additions & 4 deletions app/models/manager_refresh/inventory_object_lazy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ def skeletal_precreate!
return if keys.any? { |x| full_reference[x].blank? }

skeletal_primary_index.build(full_reference)

# TODO(lsmola) what do I need this for? Skeletal record can break :key, since the record won't be fetched by DB
# strategy and :key is missing in skeletal record. Write spec!
# value_inventory_collection.skeletal_manager_uuids << value.stringified_reference
end

def load_object_with_key
Expand Down

0 comments on commit 5e057e5

Please sign in to comment.