Module: Soter

Defined in:
lib/soter.rb,
lib/soter/config.rb,
lib/soter/job_worker.rb

Defined Under Namespace

Classes: Config, JobWorker

Class Method Summary collapse

Class Method Details

.configObject



11
12
13
# File 'lib/soter.rb', line 11

def self.config
  @config ||= Soter::Config.new
end

.dequeue(job_params) ⇒ Object



29
30
31
# File 'lib/soter.rb', line 29

def self.dequeue(job_params)
  queue.remove('job_params' => job_params)
end

.enqueue(handler, job_params = {}, queue_options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/soter.rb', line 15

def self.enqueue(handler, job_params={}, queue_options={})
  job = {
    'job' => {
      'params' => job_params,
      'class' => handler.to_s
    },
    'queue_options' => queue_options,
    'active_at' => queue_options.delete(:active_at)
  }

  queue.insert(job)
  dispatch_worker
end