Sha256: 6d8305be95ec444705ca4521c08075fa56f57a678df4e9086f1606c0f4748099
Contents?: true
Size: 894 Bytes
Versions: 2
Compression:
Stored size: 894 Bytes
Contents
require 'sidekiq' require 'sidekiq/util' require 'sidekiq/cron' require 'sidekiq/scheduled' module Sidekiq module Cron # The Poller checks Redis every N seconds for sheduled cron jobs class Poller < Sidekiq::Scheduled::Poller 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 logger.error ex.message logger.error ex.backtrace.first end private def enqueue_job(job, time = Time.now.utc) job.test_and_enque_for_time! time if job && job.valid? rescue => ex # problem somewhere in one job logger.error "CRON JOB: #{ex.message}" logger.error "CRON JOB: #{ex.backtrace.first}" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-cron-0.5.1 | lib/sidekiq/cron/poller.rb |
sidekiq-cron-0.5.0 | lib/sidekiq/cron/poller.rb |