Class: Sidekiq::SortedEntry
Instance Attribute Summary collapse
-
#score ⇒ Object
readonly
Returns the value of attribute score.
Attributes inherited from Job
Instance Method Summary collapse
- #at ⇒ Object
- #delete ⇒ Object
-
#initialize(parent, score, item) ⇒ SortedEntry
constructor
A new instance of SortedEntry.
- #retry ⇒ Object
Methods inherited from Job
#[], #args, #jid, #klass, #queue
Constructor Details
#initialize(parent, score, item) ⇒ SortedEntry
Returns a new instance of SortedEntry.
199 200 201 202 203 |
# File 'lib/sidekiq/api.rb', line 199 def initialize(parent, score, item) super(item) @score = score @parent = parent end |
Instance Attribute Details
#score ⇒ Object (readonly)
Returns the value of attribute score.
197 198 199 |
# File 'lib/sidekiq/api.rb', line 197 def score @score end |
Instance Method Details
#at ⇒ Object
205 206 207 |
# File 'lib/sidekiq/api.rb', line 205 def at Time.at(score) end |
#delete ⇒ Object
209 210 211 |
# File 'lib/sidekiq/api.rb', line 209 def delete @parent.delete(score, jid) end |
#retry ⇒ Object
213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/sidekiq/api.rb', line 213 def retry raise "Retry not available on jobs not in the Retry queue." unless item["failed_at"] Sidekiq.redis do |conn| results = conn.zrangebyscore('retry', score, score) conn.zremrangebyscore('retry', score, score) results.map do || msg = Sidekiq.load_json() msg['retry_count'] = msg['retry_count'] - 1 conn.rpush("queue:#{msg['queue']}", Sidekiq.dump_json(msg)) end end end |