Class: LiveQA::AsyncHandlers::Sidekiq

Inherits:
Base
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
lib/liveqa/async_handlers/sidekiq.rb

Constant Summary collapse

OPTIONS =
{
  'queue' => 'liveqa',
  'class' => self
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#execute

Constructor Details

#initialize(options = {}) ⇒ Sidekiq

Returns a new instance of Sidekiq.



15
16
17
18
19
# File 'lib/liveqa/async_handlers/sidekiq.rb', line 15

def initialize(options = {})
  @options = OPTIONS.merge(
    Util.deep_stringify_key(options)
  )
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



13
14
15
# File 'lib/liveqa/async_handlers/sidekiq.rb', line 13

def options
  @options
end

Instance Method Details

#enqueue(*args) ⇒ Object



21
22
23
24
25
# File 'lib/liveqa/async_handlers/sidekiq.rb', line 21

def enqueue(*args)
  ::Sidekiq::Client.push(
    options.merge('args' => args)
  )
end

#perform(*args) ⇒ Object



27
28
29
# File 'lib/liveqa/async_handlers/sidekiq.rb', line 27

def perform(*args)
  execute(args)
end