diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-17 14:02:12 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-17 14:02:12 +0200 |
commit | e41d42d6a2f5775b8f165cb00617dc956d3ca097 (patch) | |
tree | c4d988640e90bdfde79bb8349723236cce1f902d /lib | |
parent | af41bd41e9c018eaac4ba9f1e6165aeea894f824 (diff) | |
download | gitlab-ce-e41d42d6a2f5775b8f165cb00617dc956d3ca097.tar.gz |
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')
-rw-r--r-- | lib/gitlab/background_migration.rb | 18 |
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 |