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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-19 21:09:10 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-19 21:09:10 +0300
commit33795139ea8e72756bee3675b4e16387425e6ab1 (patch)
tree3ca568fca61482e57810ee30ad5ce4b964a82c4e /app/workers/background_migration_worker.rb
parentc7e385e282bcb8505589bce526e692b7bb819ffa (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers/background_migration_worker.rb')
-rw-r--r--app/workers/background_migration_worker.rb24
1 files changed, 13 insertions, 11 deletions
diff --git a/app/workers/background_migration_worker.rb b/app/workers/background_migration_worker.rb
index 20e2cdd7f96..231c2bcd83b 100644
--- a/app/workers/background_migration_worker.rb
+++ b/app/workers/background_migration_worker.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class BackgroundMigrationWorker
+class BackgroundMigrationWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category_not_owned!
@@ -22,17 +22,19 @@ class BackgroundMigrationWorker
# class_name - The class name of the background migration to run.
# arguments - The arguments to pass to the migration class.
def perform(class_name, arguments = [])
- should_perform, ttl = perform_and_ttl(class_name)
+ with_context(caller_id: class_name.to_s) do
+ should_perform, ttl = perform_and_ttl(class_name)
- if should_perform
- Gitlab::BackgroundMigration.perform(class_name, arguments)
- else
- # If the lease could not be obtained this means either another process is
- # running a migration of this class or we ran one recently. In this case
- # we'll reschedule the job in such a way that it is picked up again around
- # the time the lease expires.
- self.class
- .perform_in(ttl || self.class.minimum_interval, class_name, arguments)
+ if should_perform
+ Gitlab::BackgroundMigration.perform(class_name, arguments)
+ else
+ # If the lease could not be obtained this means either another process is
+ # running a migration of this class or we ran one recently. In this case
+ # we'll reschedule the job in such a way that it is picked up again around
+ # the time the lease expires.
+ self.class
+ .perform_in(ttl || self.class.minimum_interval, class_name, arguments)
+ end
end
end