Skip to content

Commit

Permalink
Merge pull request ManageIQ#120 from jaywcarman/duplicate_record_log_…
Browse files Browse the repository at this point in the history
…destroy_result

Log destroy result when duplicate record is found
  • Loading branch information
agrare committed May 6, 2024
2 parents 150dbe1 + 6cb039e commit adfb3e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/inventory_refresh/save_collection/saver/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def assert_unique_record(record, index)
if unique_db_indexes.include?(index) # Include on Set is O(1)
# We have a duplicate in the DB, destroy it. A find_each method does automatically .order(:id => :asc)
# so we always keep the oldest record in the case of duplicates.
logger.warn("A duplicate record was detected and destroyed, inventory_collection: "\
destroyed = record.destroy ? "and destroyed" : "but could not be destroyed"
logger.warn("A duplicate record was detected #{destroyed}, inventory_collection:" \
"'#{inventory_collection}', record: '#{record}', duplicate_index: '#{index}'")
record.destroy
return false
else
unique_db_indexes << index
Expand Down

0 comments on commit adfb3e5

Please sign in to comment.