module Rworkflow::SidekiqHelper::ClassMethods

Public Instance Methods

enqueue_job(*params) click to toggle source

Mix-in methods

# File lib/rworkflow/sidekiq_helper.rb, line 11
def enqueue_job(*params)
  if should_perform_job_async?
    self.perform_async(*params)
  else
    inline_perform(params)
  end
end
inline_perform(params) click to toggle source
# File lib/rworkflow/sidekiq_helper.rb, line 23
def inline_perform(params)
  worker = self.new
  args = JSON.parse(params.to_json)
  jid = Digest::MD5.hexdigest((Time.now.to_f * 1000).to_i.to_s)
  worker.jid = jid
  worker.perform(*args)
end
should_perform_job_async?() click to toggle source
# File lib/rworkflow/sidekiq_helper.rb, line 19
def should_perform_job_async?
  return Rworkflow.config.sidekiq_perform_async
end