Module: Workers::StatusBroadcastable::Overrides
- Included in:
- Workers::StatusBroadcastable
- Defined in:
- app/concerns/workers/status_broadcastable.rb
Overview
Overrides for at/total/store that must be PREPENDED so they sit above
Sidekiq::Status::Worker in the MRO (StatusBroadcastable itself is included
after Sidekiq::Status::Worker, so plain instance methods on it would lose
the method-lookup race).
Instance Method Summary collapse
-
#at(step, message = nil) ⇒ Object
Records the current step and fires a live progress broadcast.
-
#store(hash = {}) ⇒ Object
Called when job completes or stores flash messages (redirect_to, etc.).
-
#total(total_steps = nil) ⇒ Object
Sets the total number of steps and fires a live progress broadcast.
Instance Method Details
#at(step, message = nil) ⇒ Object
Records the current step and fires a live progress broadcast.
43 44 45 46 47 |
# File 'app/concerns/workers/status_broadcastable.rb', line 43 def at(step, = nil) result = super broadcast_job_status if broadcast_enabled? result end |
#store(hash = {}) ⇒ Object
Called when job completes or stores flash messages (redirect_to, etc.)
63 64 65 66 67 68 69 70 71 |
# File 'app/concerns/workers/status_broadcastable.rb', line 63 def store(hash = {}) result = super if hash.keys.any? { |k| terminal_status_key?(k) } broadcast_job_status(terminal: true) elsif broadcast_enabled? broadcast_job_status end result end |
#total(total_steps = nil) ⇒ Object
Sets the total number of steps and fires a live progress broadcast.
53 54 55 56 57 |
# File 'app/concerns/workers/status_broadcastable.rb', line 53 def total(total_steps = nil) result = super broadcast_job_status if broadcast_enabled? result end |