Module: Amigo::ScheduledJob::InstanceMethods

Defined in:
lib/amigo/scheduled_job.rb

Instance Method Summary collapse

Instance Method Details

#loggerObject



20
21
22
# File 'lib/amigo/scheduled_job.rb', line 20

def logger
  return Sidekiq.logger
end

#perform(*args) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/amigo/scheduled_job.rb', line 24

def perform(*args)
  splay = self.class.splay_duration
  if splay.nil? || args == [true]
    self._perform
  elsif args.empty?
    jitter = rand(0..self.class.splay_duration.to_i)
    self.class.perform_in(jitter, true)
  else
    raise "ScheduledJob#perform must be called with no arguments, or [true]"
  end
end