summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2019-07-05 19:18:15 +0200
committerDouwe Maan <douwe@selenight.nl>2019-07-05 19:42:29 +0200
commit840e6fdb8f4194f6ca52b245d67199f3d2a41b3c (patch)
treec6084e0894484bc4c0625dbd5165ad0f85610edc /app
parent27c4b8aadd8e5137341c8966d7b7af3833521816 (diff)
downloadgitlab-ce-840e6fdb8f4194f6ca52b245d67199f3d2a41b3c.tar.gz
Add queue_size method to ApplicationWorkerdm-queue-mirror-jobs-in-batches-drain-ce
Diffstat (limited to 'app')
-rw-r--r--app/workers/concerns/application_worker.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/workers/concerns/application_worker.rb b/app/workers/concerns/application_worker.rb
index 25c3a945077..2b36ccb8304 100644
--- a/app/workers/concerns/application_worker.rb
+++ b/app/workers/concerns/application_worker.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require 'sidekiq/api'
+
Sidekiq::Worker.extend ActiveSupport::Concern
module ApplicationWorker
@@ -44,6 +46,10 @@ module ApplicationWorker
get_sidekiq_options['queue'].to_s
end
+ def queue_size
+ Sidekiq::Queue.new(queue).size
+ end
+
def bulk_perform_async(args_list)
Sidekiq::Client.push_bulk('class' => self, 'args' => args_list)
end