lib/sidekiq/scheduler.rb
# Loads a job schedule into the Rufus::Scheduler and stores it in @@scheduled_jobs
Loads a job schedule into the Rufus::Scheduler and stores it in @@scheduled_jobs
Loads a job schedule into the Rufus :: Scheduler and stores it in @@scheduled_jobs
def load_schedule_job(name, config)
        if config['rails_env'].nil? || rails_env_matches?(config)
          logger.info "Scheduling #{name} #{config}"
          interval_defined = false
          interval_types = %w{cron every at in interval}
          interval_types.each do |interval_type|
            config_interval_type = config[interval_type]
            if !config_interval_type.nil? && config_interval_type.length > 0
              schedule, options = SidekiqScheduler::RufusUtils.normalize_schedule_options(config_interval_type)
              rufus_job = new_job(name, interval_type, config, schedule, options)
              @@scheduled_jobs[name] = rufus_job
              update_job_next_time(name, rufus_job.next_time)
              interval_defined = true
              break
            end
          end
          unless interval_defined
            logger.info "no #{interval_types.join(' / ')} found for #{config['class']} (#{name}) - skipping"
          end
        end
      end
def load_schedule_job ( name , config ) if config [ 'rails_env' ] . nil? || rails_env_matches? ( config ) logger . info "Scheduling #{name} #{config}" interval_defined = false interval_types = %w{ cron every at in interval } interval_types . each do | interval_type | config_interval_type = config [ interval_type ] if ! config_interval_type . nil? && config_interval_type . length > 0 schedule , options = SidekiqScheduler :: RufusUtils . normalize_schedule_options ( config_interval_type ) rufus_job = new_job ( name , interval_type , config , schedule , options ) @@scheduled_jobs [ name ] = rufus_job update_job_next_time ( name , rufus_job . next_time ) interval_defined = true break end end unless interval_defined logger . info "no #{interval_types.join(' / ')} found for #{config['class']} (#{name}) - skipping" end end end
Loads a job schedule into the Rufus::Scheduler and stores it in @@scheduled_jobs
Loads a job schedule into the Rufus :: Scheduler and stores it in @@scheduled_jobs
# If rails_env is set in the config, enforce ENV['RAILS_ENV'] as # required for the jobs to be scheduled.  If rails_env is missing, the # job should be scheduled regardless of what ENV['RAILS_ENV'] is set # to.
name
config