Class: Sidekiq::SortedEntry
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
Attributes inherited from Job
Instance Method Summary collapse
- #add_to_queue ⇒ Object
- #at ⇒ Object
- #delete ⇒ Object
- #error? ⇒ Boolean
-
#initialize(parent, score, item) ⇒ SortedEntry
constructor
A new instance of SortedEntry.
-
#kill ⇒ Object
Place job in the dead set.
- #reschedule(at) ⇒ Object
- #retry ⇒ Object
Methods inherited from Job
#[], #args, #created_at, #display_args, #display_class, #enqueued_at, #jid, #klass, #latency, #parse, #queue
Constructor Details
#initialize(parent, score, item) ⇒ SortedEntry
Returns a new instance of SortedEntry.
443 444 445 446 447 |
# File 'lib/sidekiq/api.rb', line 443 def initialize(parent, score, item) super(item) @score = score @parent = parent end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
441 442 443 |
# File 'lib/sidekiq/api.rb', line 441 def parent @parent end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
440 441 442 |
# File 'lib/sidekiq/api.rb', line 440 def score @score end |
Instance Method Details
#add_to_queue ⇒ Object
466 467 468 469 470 471 |
# File 'lib/sidekiq/api.rb', line 466 def add_to_queue remove_job do || msg = Sidekiq.load_json() Sidekiq::Client.push(msg) end end |
#at ⇒ Object
449 450 451 |
# File 'lib/sidekiq/api.rb', line 449 def at Time.at(score).utc end |
#delete ⇒ Object
453 454 455 456 457 458 459 |
# File 'lib/sidekiq/api.rb', line 453 def delete if @value @parent.delete_by_value(@parent.name, @value) else @parent.delete_by_jid(score, jid) end end |
#error? ⇒ Boolean
489 490 491 |
# File 'lib/sidekiq/api.rb', line 489 def error? !!item['error_class'] end |
#kill ⇒ Object
Place job in the dead set
483 484 485 486 487 |
# File 'lib/sidekiq/api.rb', line 483 def kill remove_job do || DeadSet.new.kill() end end |
#reschedule(at) ⇒ Object
461 462 463 464 |
# File 'lib/sidekiq/api.rb', line 461 def reschedule(at) delete @parent.schedule(at, item) end |