Method: Sidekiq::Job::ClassMethods#perform_in

Defined in:
lib/sidekiq/job.rb

#perform_in(interval, *args) ⇒ Object Also known as: perform_at

interval must be a timestamp, numeric or something that acts

numeric (like an activesupport time interval).


334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/sidekiq/job.rb', line 334

def perform_in(interval, *args)
  int = interval.to_f
  now = Time.now.to_f
  ts = ((int < 1_000_000_000) ? now + int : int)

  item = {"class" => self, "args" => args}

  # Optimization to enqueue something now that is scheduled to go out now or in the past
  item["at"] = ts if ts > now

  client_push(item)
end