diff --git a/lib/inventory_refresh/save_collection/saver/default.rb b/lib/inventory_refresh/save_collection/saver/default.rb index 2b4d6527..1dc220cd 100644 --- a/lib/inventory_refresh/save_collection/saver/default.rb +++ b/lib/inventory_refresh/save_collection/saver/default.rb @@ -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