Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix saving of refresh stats #15775

Merged
merged 2 commits into from
Aug 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def update_or_destroy_records!(records_batch_iterator, inventory_objects_index,
hash
end
assign_attributes_for_update!(hash_for_update, update_time)
inventory_collection.store_updated_records([{:id => primary_key_value}])

hash_for_update[:id] = primary_key_value
hashes_for_update << hash_for_update
Expand Down Expand Up @@ -163,7 +162,7 @@ def destroy_records!(records)
rails_delete = %i(destroy delete).include?(inventory_collection.delete_method)
if !rails_delete && inventory_collection.model_class.respond_to?(inventory_collection.delete_method)
# We have custom delete method defined on a class, that means it supports batch destroy
# TODO(lsmola) store deleted records to IC
inventory_collection.store_deleted_records(records.map { |x| {:id => record_key(x, primary_key)} })
inventory_collection.model_class.public_send(inventory_collection.delete_method, records.map { |x| record_key(x, primary_key) })
else
# We have either standard :destroy and :delete rails method, or custom instance level delete method
Expand All @@ -185,6 +184,7 @@ def destroy_records!(records)

def update_records!(all_attribute_keys, hashes)
return if hashes.blank?
inventory_collection.store_updated_records(hashes)
query = build_update_query(all_attribute_keys, hashes)
get_connection.execute(query)
end
Expand Down