Module: CheckerJobs::JobsProcessors::Sidekiq::ClassMethods

Defined in:
lib/checker_jobs/jobs_processors/sidekiq.rb

Instance Method Summary collapse

Instance Method Details

#options(*args) ⇒ Object

Overrides DSL#options in order to pass specific options to Sidekiq. The options could be the queue the job processor must use, or other middleware options of your choice.



24
25
26
27
28
# File 'lib/checker_jobs/jobs_processors/sidekiq.rb', line 24

def options(*args)
  super(*args).tap do
    sidekiq_options option(:sidekiq, {})
  end
end

#perform_check_in(check, interval) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/checker_jobs/jobs_processors/sidekiq.rb', line 30

def perform_check_in(check, interval)
  # Borrowed from Sidekiq implementation
  item = {
    "class" => self,
    "args" => [check.name.to_s],
    "at" => Time.now.to_f + interval.to_f,
  }

  if (specific_queue = check.options[:queue])
    item["queue"] = specific_queue.to_s
  end

  client_push(item)
end