diff options
author | Bob Van Landuyt <bob@gitlab.com> | 2019-07-05 19:25:44 +0000 |
---|---|---|
committer | Bob Van Landuyt <bob@gitlab.com> | 2019-07-05 19:25:44 +0000 |
commit | 0cb361fe8f4bd06d9f42e3e7f797631acb4f8d60 (patch) | |
tree | 055bafcbef5ef140baa95c0fd131fd790f2b1ba7 | |
parent | 2cbc72d93e120d8eb53ff0c9191fc00d7bab6a21 (diff) | |
parent | 840e6fdb8f4194f6ca52b245d67199f3d2a41b3c (diff) | |
download | gitlab-ce-0cb361fe8f4bd06d9f42e3e7f797631acb4f8d60.tar.gz |
Merge branch 'dm-queue-mirror-jobs-in-batches-drain-ce' into 'master'
Add queue_size method to ApplicationWorker
See merge request gitlab-org/gitlab-ce!30416
-rw-r--r-- | app/workers/concerns/application_worker.rb | 6 |
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 |