Method: Resque::Scheduler::SchedulingExtensions#set_schedule

Defined in:
lib/resque/scheduler/scheduling_extensions.rb

#set_schedule(name, config, reload = true) ⇒ Object

Create or update a schedule with the provided name and configuration.

Note: values for class and custom_job_class need to be strings, not constants.

Resque.set_schedule('some_job', {:class => 'SomeJob',
                                 :every => '15mins',
                                 :queue => 'high',
                                 :args => '/tmp/poop'})

Preventing a reload is optional and available to batch operations



85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/resque/scheduler/scheduling_extensions.rb', line 85

def set_schedule(name, config, reload = true)
  persist = config.delete(:persist) || config.delete('persist')

  if persist
    redis.hset(:persistent_schedules, name, encode(config))
  else
    non_persistent_schedules[name] = decode(encode(config))
  end

  redis.sadd(:schedules_changed, [name])
  reload_schedule! if reload
end