Skip to content

Commit

Permalink
fix "undefined method logger" error
Browse files Browse the repository at this point in the history
  • Loading branch information
bkiahstroud committed Oct 11, 2024
1 parent ff50053 commit 32ae8a7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bin/ia_to_s3_migrator
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def check_concurrency_limit(increase)
# Stay under the default AWS Lambda concurrency limit
return if (@potential_concurrent_executions + increase) < 1_000

logger.debug('AWS Lambda concurrency limit reached, will continue after 10 minutes')
@logger.debug('AWS Lambda concurrency limit reached, will continue after 10 minutes')
# HACK: Assume all active Lambda executions will finish within 10 minutes
sleep 600
@potential_concurrent_executions = 0
Expand All @@ -26,7 +26,7 @@ def preprocess_within_concurrency_limit(iaid, concurrency_increase, msg)
raise StandardError, "Block containing preprocess logic for #{iaid} is required" unless block_given?

check_concurrency_limit(concurrency_increase)
logger.info(msg)
@logger.info(msg)

yield

Expand All @@ -44,7 +44,7 @@ raise "No file found at #{json_path}" unless json_path.exist?
preprocessable_iaids = @hash.select { |_iaid, data| data['status'] == 'WARN' }
@potential_concurrent_executions = 0

logger = Logger.new('log/ia_to_s3_migrator.log')
@logger = Logger.new('log/ia_to_s3_migrator.log')
puts '== Tail log/ia_to_s3_migrator.log for logs =='

begin
Expand Down Expand Up @@ -85,7 +85,7 @@ begin
end
end
rescue => e
logger.error("#{iaid} -- ERROR -- #{e.detailed_message(highlight: false)}")
@logger.error("#{iaid} -- ERROR -- #{e.detailed_message(highlight: false)}")
end
ensure
puts "\nBacking up existing data to #{json_path}.bak"
Expand Down

0 comments on commit 32ae8a7

Please sign in to comment.