Add queue_size method to ApplicationWorker

This commit is contained in:
Douwe Maan 2019-07-05 19:18:15 +02:00
parent 27c4b8aadd
commit 840e6fdb8f
No known key found for this signature in database
GPG Key ID: 5976703F65143D36
1 changed files with 6 additions and 0 deletions

View File

@ -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