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:
authorJames Lopez <james@jameslopez.es>2017-04-06 10:48:58 +0300
committerJames Lopez <james@jameslopez.es>2017-04-06 10:48:58 +0300
commit94716c279f35c787d5b41ed626ad9bfc1acf83aa (patch)
tree5c902a8f2008be67368b0f23dc0842a0bc80972a /app/workers
parent44ec40028c60b4f3a5d3f1bb049996f4d2caf9af (diff)
remove unnecessary lease as cron job
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/stuck_import_jobs_worker.rb13
1 files changed, 0 insertions, 13 deletions
diff --git a/app/workers/stuck_import_jobs_worker.rb b/app/workers/stuck_import_jobs_worker.rb
index c7871d99492..bfc5e667bb6 100644
--- a/app/workers/stuck_import_jobs_worker.rb
+++ b/app/workers/stuck_import_jobs_worker.rb
@@ -2,12 +2,9 @@ class StuckImportJobsWorker
include Sidekiq::Worker
include CronjobQueue
- EXCLUSIVE_LEASE_KEY = 'fail_stuck_imports_worker_lease'.freeze
IMPORT_EXPIRATION = 15.hours.to_i
def perform
- return unless try_obtain_lease
-
stuck_projects.find_in_batches(batch_size: 500) do |group|
jids = group.map(&:import_jid)
@@ -20,8 +17,6 @@ class StuckImportJobsWorker
fail_batch!(completed_jids, completed_ids)
end
end
-
- remove_lease
end
private
@@ -39,12 +34,4 @@ class StuckImportJobsWorker
def error_message
"Import timed out. Import took longer than #{IMPORT_EXPIRATION} seconds"
end
-
- def try_obtain_lease
- @uuid = Gitlab::ExclusiveLease.new(EXCLUSIVE_LEASE_KEY, timeout: 30.minutes).try_obtain
- end
-
- def remove_lease
- Gitlab::ExclusiveLease.cancel(EXCLUSIVE_LEASE_KEY, @uuid)
- end
end