class KueRuby::KueJob

Job record from Automattic Kue redis store

Attributes

backoff[RW]
created_at[RW]
data[RW]
delay[RW]
id[RW]
max_attempts[RW]
priority[RW]
promote_at[RW]
state[RW]
type[RW]
updated_at[RW]
zid[RW]

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/kue_ruby.rb, line 97
def initialize
  self.delay = 0
  super()
end

Public Instance Methods

save(kue) click to toggle source

Save job data to redis kue

@param KueRuby KueRuby instance with redis connection

@return [KueJob] the kue job

# File lib/kue_ruby.rb, line 107
def save(kue)
  save! kue
rescue
  nil
end
save!(kue) click to toggle source

Save job data to redis kue

@param KueRuby KueRuby instance with redis connection

@return KueJob the kue job, throwing on exception

# File lib/kue_ruby.rb, line 118
def save!(kue)
  kue.redis.hmset(
    "#{kue.prefix}:job:#{id}",
    'max_attempts',   max_attempts.to_i,
    'backoff',        backoff.to_json,
    'type',           type,
    'created_at',     (created_at.to_f * 1000).to_i,
    'updated_at',     (Time.now.to_f * 1000).to_i,
    'promote_at',     (Time.now.to_f * 1000).to_i + delay,
    'priority',       priority.to_i,
    'data',           data.to_json,
    'state',          state
  )
  self
end