From 9b34dcf8f20edef8b76428ff1c5ff351dc76cf89 Mon Sep 17 00:00:00 2001 From: Brett Walker <bwalker@gitlab.com> Date: Fri, 6 Nov 2020 14:59:09 -0600 Subject: [PATCH] Rewrite comment for better clarity --- app/workers/background_migration_worker.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/workers/background_migration_worker.rb b/app/workers/background_migration_worker.rb index 17aa43856c013..70c4ad537264b 100644 --- a/app/workers/background_migration_worker.rb +++ b/app/workers/background_migration_worker.rb @@ -59,8 +59,10 @@ def perform_and_ttl(class_name, attempts_left) database_unhealthy_counter.increment if lease_obtained && !healthy_db - # If we've tried several times to get a lease with a healthy DB without success, just give up. - # Otherwise we could end up in an infinite rescheduling loop. + # When the DB is unhealthy or the lease can't be obtained after several tries, + # then give up on the job and log a warning. Otherwise we could end up in + # an infinite rescheduling loop. Jobs can be tracked in the database with the + # use of Gitlab::Database::BackgroundMigrationJob if !perform && attempts_left < 0 msg = if !lease_obtained 'Job could not get an exclusive lease after several tries. Giving up.' -- GitLab