Class: Sidekiq::Cron::Poller

Inherits:
Scheduled::Poller
  • Object
show all
Defined in:
lib/sidekiq/cron/poller.rb

Overview

The Poller checks Redis every N seconds for scheduled cron jobs.

Instance Method Summary collapse

Constructor Details

#initialize(config = nil) ⇒ Poller

Returns a new instance of Poller.



9
10
11
# File 'lib/sidekiq/cron/poller.rb', line 9

def initialize(config = nil)
  super
end

Instance Method Details

#enqueueObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/sidekiq/cron/poller.rb', line 19

def enqueue
  time = Time.now.utc
  Sidekiq::Cron::Job.all('*').each do |job|
    enqueue_job(job, time)
  end
rescue => ex
  # Most likely a problem with redis networking.
  # Punt and try again at the next interval.
  Sidekiq.logger.error ex.message
  Sidekiq.logger.error ex.backtrace.first
  handle_exception(ex) if respond_to?(:handle_exception)
end

#startObject



13
14
15
16
17
# File 'lib/sidekiq/cron/poller.rb', line 13

def start
  Sidekiq::Cron::Job.migrate_old_jobs_if_needed!

  super
end