Skip to content

Commit

Permalink
Merge pull request ManageIQ#15775 from Ladas/fix_saving_of_refresh_stats
Browse files Browse the repository at this point in the history
Fix saving of refresh stats
  • Loading branch information
agrare authored Aug 11, 2017
2 parents 6e95e67 + 54eb02c commit 8067a39
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,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 @@ -164,7 +163,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 @@ -186,6 +185,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

0 comments on commit 8067a39

Please sign in to comment.