Class: Sidekiq::Batch::Status
- Inherits:
-
Object
- Object
- Sidekiq::Batch::Status
- Defined in:
- lib/sidekiq/batch/status.rb
Instance Attribute Summary collapse
-
#bid ⇒ Object
readonly
Returns the value of attribute bid.
Instance Method Summary collapse
- #child_count ⇒ Object
- #complete? ⇒ Boolean
- #created_at ⇒ Object
- #data ⇒ Object
- #failure_info ⇒ Object
- #failures ⇒ Object
-
#initialize(bid) ⇒ Status
constructor
A new instance of Status.
- #join ⇒ Object
- #parent_bid ⇒ Object
- #pending ⇒ Object
- #total ⇒ Object
Constructor Details
#initialize(bid) ⇒ Status
Returns a new instance of Status.
6 7 8 |
# File 'lib/sidekiq/batch/status.rb', line 6 def initialize(bid) @bid = bid end |
Instance Attribute Details
#bid ⇒ Object (readonly)
Returns the value of attribute bid.
4 5 6 |
# File 'lib/sidekiq/batch/status.rb', line 4 def bid @bid end |
Instance Method Details
#child_count ⇒ Object
42 43 44 |
# File 'lib/sidekiq/batch/status.rb', line 42 def child_count Sidekiq.redis { |r| r.hget("BID-#{bid}", 'children') }.to_i end |
#complete? ⇒ Boolean
38 39 40 |
# File 'lib/sidekiq/batch/status.rb', line 38 def complete? 'true' == Sidekiq.redis { |r| r.hget("BID-#{bid}", 'complete') } end |
#created_at ⇒ Object
22 23 24 |
# File 'lib/sidekiq/batch/status.rb', line 22 def created_at Sidekiq.redis { |r| r.hget("BID-#{bid}", 'created_at') } end |
#data ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/sidekiq/batch/status.rb', line 46 def data { bid: bid, total: total, failures: failures, pending: pending, created_at: created_at, complete: complete?, failure_info: failure_info, parent_bid: parent_bid, child_count: child_count } end |
#failure_info ⇒ Object
34 35 36 |
# File 'lib/sidekiq/batch/status.rb', line 34 def failure_info Sidekiq.redis { |r| r.smembers("BID-#{bid}-failed") } || [] end |
#failures ⇒ Object
18 19 20 |
# File 'lib/sidekiq/batch/status.rb', line 18 def failures Sidekiq.redis { |r| r.scard("BID-#{bid}-failed") }.to_i end |
#join ⇒ Object
10 11 12 |
# File 'lib/sidekiq/batch/status.rb', line 10 def join raise "Not supported" end |
#parent_bid ⇒ Object
30 31 32 |
# File 'lib/sidekiq/batch/status.rb', line 30 def parent_bid Sidekiq.redis { |r| r.hget("BID-#{bid}", "parent_bid") } end |
#pending ⇒ Object
14 15 16 |
# File 'lib/sidekiq/batch/status.rb', line 14 def pending Sidekiq.redis { |r| r.hget("BID-#{bid}", 'pending') }.to_i end |
#total ⇒ Object
26 27 28 |
# File 'lib/sidekiq/batch/status.rb', line 26 def total Sidekiq.redis { |r| r.hget("BID-#{bid}", 'total') }.to_i end |