diff options
Diffstat (limited to 'lib/gitlab/background_migration.rb')
-rw-r--r-- | lib/gitlab/background_migration.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/gitlab/background_migration.rb b/lib/gitlab/background_migration.rb index cb0ac9221a0..3586c6a2560 100644 --- a/lib/gitlab/background_migration.rb +++ b/lib/gitlab/background_migration.rb @@ -48,12 +48,17 @@ module Gitlab # # arguments - The arguments to pass to the background migration's "perform" # method. - def self.perform(class_name, arguments, retries: 1) + def self.perform(class_name, arguments, retries: 0) const_get(class_name).new.perform(*arguments) - rescue => e - Rails.logger.warn("Retrying background migration #{class_name} " \ - "with #{arguments}") - (retries -= 1) > 0 ? retry : raise + rescue StandardError + if retries > 0 + Rails.logger.warn("Retrying background migration #{class_name} " \ + "with #{arguments}") + retries -= 1 + retry + else + raise + end end end end |