Module: Rworkflow::SidekiqHelper

Included in:
Worker
Defined in:
lib/rworkflow/sidekiq_helper.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.configure_client(host, port, db) ⇒ Object



67
68
69
70
71
# File 'lib/rworkflow/sidekiq_helper.rb', line 67

def configure_client host, port, db
  Sidekiq.configure_client do |config|
    config.redis = {:url => "redis://#{host}:#{port}/#{db}", :namespace => 'sidekiq'}
  end
end

.configure_server(host, port, db) ⇒ Object



58
59
60
61
62
63
64
65
# File 'lib/rworkflow/sidekiq_helper.rb', line 58

def configure_server host, port, db
  Sidekiq.configure_server do |config|
    config.redis = {:url => "redis://#{host}:#{port}/#{db}", :namespace => 'sidekiq'}
    config.server_middleware do |chain|
      chain.add SidekiqServerMiddleware
    end
  end
end

.get_queue_sizesObject



73
74
75
76
# File 'lib/rworkflow/sidekiq_helper.rb', line 73

def get_queue_sizes
  stats = Sidekiq::Stats.new
  return stats.queues
end

.get_queue_sizes_sumObject



78
79
80
81
# File 'lib/rworkflow/sidekiq_helper.rb', line 78

def get_queue_sizes_sum
  stats = Sidekiq::Stats.new
  return stats.enqueued
end

.included(klass) ⇒ Object



5
6
7
8
# File 'lib/rworkflow/sidekiq_helper.rb', line 5

def self.included(klass)
  klass.send :extend,  ClassMethods
  klass.send :include, InstanceMethods
end