A platform for community discussion. Free, open, simple.
DEV: raise error only when 'STOP_ON_ERROR' env variable is available.
Vinoth Kannane44d56e4d255
diff --git a/lib/tasks/uploads.rake b/lib/tasks/uploads.rakeindex 3c4dc29ef57..bf7b539b543 100644--- a/lib/tasks/uploads.rake+++ b/lib/tasks/uploads.rake@@ -898,12 +898,13 @@ task "uploads:recover" => :environment dorequire_dependency "upload_recovery"dry_run = ENV["DRY_RUN"].present?+ stop_on_error = ENV["STOP_ON_ERROR"].present?if ENV["RAILS_DB"]- UploadRecovery.new(dry_run: dry_run).recover+ UploadRecovery.new(dry_run: dry_run, stop_on_error: stop_on_error).recoverelseRailsMultisite::ConnectionManagement.each_connection do |db|- UploadRecovery.new(dry_run: dry_run).recover+ UploadRecovery.new(dry_run: dry_run, stop_on_error: stop_on_error).recoverendendenddiff --git a/lib/upload_recovery.rb b/lib/upload_recovery.rbindex 5b3fd5b0c14..95af2dcedd9 100644--- a/lib/upload_recovery.rb+++ b/lib/upload_recovery.rb@@ -1,8 +1,9 @@# frozen_string_literal: trueclass UploadRecovery- def initialize(dry_run: false)+ def initialize(dry_run: false, stop_on_error: false)@dry_run = dry_run+ @stop_on_error = stop_on_errorenddef recover(posts = Post)@@ -40,7 +41,7 @@ class UploadRecoveryendendrescue => e- raise e unless @dry_run+ raise e if @stop_on_errorputs "#{post.full_url} #{e.class}: #{e.message}"endend