Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-17 15:02:12 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-17 15:02:12 +0300
commite41d42d6a2f5775b8f165cb00617dc956d3ca097 (patch)
treec4d988640e90bdfde79bb8349723236cce1f902d /lib/gitlab/background_migration.rb
parentaf41bd41e9c018eaac4ba9f1e6165aeea894f824 (diff)
Simplify background migrations stealing code
Simply re-raise an exception when it occurs, but guarantee that no background migration is lost in the process.
Diffstat (limited to 'lib/gitlab/background_migration.rb')
-rw-r--r--lib/gitlab/background_migration.rb18
1 files changed, 3 insertions, 15 deletions
diff --git a/lib/gitlab/background_migration.rb b/lib/gitlab/background_migration.rb
index 3586c6a2560..b0741b1fba7 100644
--- a/lib/gitlab/background_migration.rb
+++ b/lib/gitlab/background_migration.rb
@@ -27,9 +27,7 @@ module Gitlab
begin
perform(migration_class, migration_args, retries: 3) if job.delete
- rescue StandardError
- next
- rescue Exception
+ rescue Exception # rubocop:disable Lint/RescueException
BackgroundMigrationWorker # enqueue this migration again
.perform_async(migration_class, migration_args)
@@ -40,25 +38,15 @@ module Gitlab
end
##
- # Performs a background migration. In case of `StandardError` being caught
- # this will retry a migration up to three times.
+ # Performs a background migration.
#
# class_name - The name of the background migration class as defined in the
# Gitlab::BackgroundMigration namespace.
#
# arguments - The arguments to pass to the background migration's "perform"
# method.
- def self.perform(class_name, arguments, retries: 0)
+ def self.perform(class_name, arguments)
const_get(class_name).new.perform(*arguments)
- rescue StandardError
- if retries > 0
- Rails.logger.warn("Retrying background migration #{class_name} " \
- "with #{arguments}")
- retries -= 1
- retry
- else
- raise
- end
end
end
end