Class: Sidekiq::SortedEntry
Constant Summary
Constants inherited from Job
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
- 
  
    
      #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, #display_args, #display_class, #enqueued_at, #jid, #klass, #latency, #queue
Constructor Details
#initialize(parent, score, item) ⇒ SortedEntry
Returns a new instance of SortedEntry.
| 284 285 286 287 288 | # File 'lib/sidekiq/api.rb', line 284 def initialize(parent, score, item) super(item) @score = score @parent = parent end | 
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
| 282 283 284 | # File 'lib/sidekiq/api.rb', line 282 def parent @parent end | 
#score ⇒ Object (readonly)
Returns the value of attribute score.
| 281 282 283 | # File 'lib/sidekiq/api.rb', line 281 def score @score end | 
Instance Method Details
#add_to_queue ⇒ Object
| 303 304 305 306 307 308 | # File 'lib/sidekiq/api.rb', line 303 def add_to_queue remove_job do || msg = Sidekiq.load_json() Sidekiq::Client.push(msg) end end | 
#at ⇒ Object
| 290 291 292 | # File 'lib/sidekiq/api.rb', line 290 def at Time.at(score).utc end | 
#delete ⇒ Object
| 294 295 296 | # File 'lib/sidekiq/api.rb', line 294 def delete @parent.delete(score, jid) end | 
#kill ⇒ Object
Place job in the dead set
| 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | # File 'lib/sidekiq/api.rb', line 321 def kill raise 'Kill not available on jobs which have not failed' unless item['failed_at'] remove_job do || Sidekiq.logger.info { "Killing job #{['jid']}" } now = Time.now.to_f Sidekiq.redis do |conn| conn.multi do conn.zadd('dead', now, ) conn.zremrangebyscore('dead', '-inf', now - DeadSet::TIMEOUT) conn.zremrangebyrank('dead', 0, - DeadSet::MAX_JOBS) end end end end | 
#reschedule(at) ⇒ Object
| 298 299 300 301 | # File 'lib/sidekiq/api.rb', line 298 def reschedule(at) @parent.delete(score, jid) @parent.schedule(at, item) end |