Skip to content

Commit

Permalink
Merge cdbf2fc into 2b105e7
Browse files Browse the repository at this point in the history
  • Loading branch information
sk274 committed Apr 22, 2019
2 parents 2b105e7 + cdbf2fc commit 2c5a1b8
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/archival_storage_ingest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,12 @@ def shutdown?
def notify_and_quit(exception, ingest_msg)
logger.fatal(exception)

error_msg = exception.to_s + "\n\n" + exception.backtrace.join("\n")

if ingest_msg.nil?
notify_error(exception.backtrace.join("\n"))
notify_error(error_msg)
else
notify_worker_error(ingest_msg: ingest_msg,
error_msg: exception.backtrace.join("\n"))
notify_worker_error(ingest_msg: ingest_msg, error_msg: error_msg)
end

exit(0)
Expand Down Expand Up @@ -194,8 +195,8 @@ def do_work
remove_wip_msg

logger.info("#{status} #{msg.ingest_id}")
rescue IngestException => ex
notify_and_quit(ex, msg)
rescue IngestException => e
notify_and_quit(e, msg)
end
end
# rubocop:enable Metrics/MethodLength
Expand All @@ -217,7 +218,10 @@ def _do_work_and_notify(msg)

def check_wip
msg = wip_q.retrieve_message
raise IngestException, "Ingest #{msg.ingest_id} crashed last run." unless msg.nil?
return if msg.nil?

notify_worker_error(ingest_msg: msg, error_msg: 'Incomplete work in progress detected.')
raise IngestException, "Incomplete work in progress for ingest #{msg.ingest_id} detected."
end

def move_msg_to_wip(msg)
Expand Down Expand Up @@ -343,6 +347,7 @@ def config_errors(ingest_config)
end

def confirm_ingest(ingest_config)
puts "Destination Queue: #{@queue_name}"
ingest_config.keys.sort.each do |key|
puts "#{key}: #{ingest_config[key]}"
end
Expand Down

0 comments on commit 2c5a1b8

Please sign in to comment.