diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-17 10:45:52 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-17 10:45:52 +0200 |
commit | af41bd41e9c018eaac4ba9f1e6165aeea894f824 (patch) | |
tree | de9596ed82c13db1e475f48a66d9f091c34ec44d /lib | |
parent | 7b146ab6c3a08f40acff5301ecaa60e8f83010a4 (diff) | |
download | gitlab-ce-af41bd41e9c018eaac4ba9f1e6165aeea894f824.tar.gz |
Fix off-by-one error in background migration retriesfix/gb/process-scheduled-background-migrations
Diffstat (limited to 'lib')
-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 |