Class: KueRuby::KueJob
- Inherits:
-
Object
- Object
- KueRuby::KueJob
- Defined in:
- lib/kue_ruby.rb
Overview
Job record from Automattic Kue redis store
Instance Attribute Summary collapse
-
#backoff ⇒ Object
Returns the value of attribute backoff.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#data ⇒ Object
Returns the value of attribute data.
-
#delay ⇒ Object
Returns the value of attribute delay.
-
#id ⇒ Object
Returns the value of attribute id.
-
#max_attempts ⇒ Object
Returns the value of attribute max_attempts.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#promote_at ⇒ Object
Returns the value of attribute promote_at.
-
#state ⇒ Object
Returns the value of attribute state.
-
#type ⇒ Object
Returns the value of attribute type.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#zid ⇒ Object
Returns the value of attribute zid.
Instance Method Summary collapse
-
#initialize ⇒ KueJob
constructor
A new instance of KueJob.
-
#save(kue) ⇒ KueJob
Save job data to redis kue.
-
#save!(kue) ⇒ Object
Save job data to redis kue.
Constructor Details
#initialize ⇒ KueJob
Returns a new instance of KueJob.
94 95 96 97 |
# File 'lib/kue_ruby.rb', line 94 def initialize self.delay = 0 super() end |
Instance Attribute Details
#backoff ⇒ Object
Returns the value of attribute backoff.
90 91 92 |
# File 'lib/kue_ruby.rb', line 90 def backoff @backoff end |
#created_at ⇒ Object
Returns the value of attribute created_at.
90 91 92 |
# File 'lib/kue_ruby.rb', line 90 def created_at @created_at end |
#data ⇒ Object
Returns the value of attribute data.
90 91 92 |
# File 'lib/kue_ruby.rb', line 90 def data @data end |
#delay ⇒ Object
Returns the value of attribute delay.
90 91 92 |
# File 'lib/kue_ruby.rb', line 90 def delay @delay end |
#id ⇒ Object
Returns the value of attribute id.
90 91 92 |
# File 'lib/kue_ruby.rb', line 90 def id @id end |
#max_attempts ⇒ Object
Returns the value of attribute max_attempts.
90 91 92 |
# File 'lib/kue_ruby.rb', line 90 def max_attempts @max_attempts end |
#priority ⇒ Object
Returns the value of attribute priority.
90 91 92 |
# File 'lib/kue_ruby.rb', line 90 def priority @priority end |
#promote_at ⇒ Object
Returns the value of attribute promote_at.
90 91 92 |
# File 'lib/kue_ruby.rb', line 90 def promote_at @promote_at end |
#state ⇒ Object
Returns the value of attribute state.
90 91 92 |
# File 'lib/kue_ruby.rb', line 90 def state @state end |
#type ⇒ Object
Returns the value of attribute type.
90 91 92 |
# File 'lib/kue_ruby.rb', line 90 def type @type end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
90 91 92 |
# File 'lib/kue_ruby.rb', line 90 def updated_at @updated_at end |
#zid ⇒ Object
Returns the value of attribute zid.
90 91 92 |
# File 'lib/kue_ruby.rb', line 90 def zid @zid end |
Instance Method Details
#save(kue) ⇒ KueJob
Save job data to redis kue
104 105 106 107 108 |
# File 'lib/kue_ruby.rb', line 104 def save(kue) save! kue rescue nil end |
#save!(kue) ⇒ Object
Save job data to redis kue
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/kue_ruby.rb', line 115 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 |