Skip to content

Commit

Permalink
DEV-1125: fix script for duplicate holdings cleanup
Browse files Browse the repository at this point in the history
* add brief documentation
* ensure it runs
  • Loading branch information
aelkiss committed May 23, 2024
1 parent f4b4aea commit 96097f3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bin/cleanup_duplicate_holdings.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# frozen_string_literal: true

require 'services'
require 'cluster'

Services.mongo!

# Iterates through clusters, removing any duplicate holdings and logging its progress.
#
# Usage: bundle exec ruby bin/cleanup_duplicate_holdings.

class CleanupDuplicateHoldings
LOG_INTERVAL = 60

Expand All @@ -14,7 +20,6 @@ def initialize
Services.logger.info("Starting cluster deduplication")
end


def run
Cluster.each do |cluster|
Services.logger.debug("Cleaning cluster #{cluster._id}: #{cluster.ocns}")
Expand Down Expand Up @@ -64,5 +69,5 @@ def dedupe_holdings(cluster)
end

if __FILE__ == $PROGRAM_NAME
CleanupDuplicateHoldings.new(ARGV).run
CleanupDuplicateHoldings.new.run
end

0 comments on commit 96097f3

Please sign in to comment.