Class: RoundhouseUi::DeadController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RoundhouseUi::DeadController
- Includes:
- JobSetBrowsing
- Defined in:
- app/controllers/roundhouse_ui/dead_controller.rb
Constant Summary
Constants included from JobSetBrowsing
JobSetBrowsing::BULK_CAP, JobSetBrowsing::PER_PAGE
Constants inherited from ApplicationController
ApplicationController::AUDIT_VERBS
Instance Method Summary collapse
-
#bulk ⇒ Object
Act on many at once: retry or delete every selected job in one request.
-
#bulk_all ⇒ Object
Smart bulk: act on EVERY job matching the current filter (not just the selected/visible ones), capped for safety.
- #destroy ⇒ Object
- #index ⇒ Object
- #requeue ⇒ Object
Methods included from JobSetBrowsing
#browse, #bulk_apply, #entry_matches?
Methods inherited from ApplicationController
Instance Method Details
#bulk ⇒ Object
Act on many at once: retry or delete every selected job in one request.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/roundhouse_ui/dead_controller.rb', line 27 def bulk set = Sidekiq::DeadSet.new count = 0 Array(params[:jids]).each do |jid| entry = set.find_job(jid) or next params[:op] == "delete" ? entry.delete : entry.retry count += 1 end verb = params[:op] == "delete" ? "Deleted" : "Re-enqueued" redirect_to dead_set_path, notice: "#{verb} #{count} job(s)." end |
#bulk_all ⇒ Object
Smart bulk: act on EVERY job matching the current filter (not just the selected/visible ones), capped for safety. Only offered when a filter is active, so it can't become "retry the entire dead set" by accident.
42 43 44 45 46 47 48 |
# File 'app/controllers/roundhouse_ui/dead_controller.rb', line 42 def bulk_all count, capped = bulk_apply(Sidekiq::DeadSet.new, params[:q].to_s.strip, params[:op]) verb = params[:op] == "delete" ? "Deleted" : "Re-enqueued" note = "#{verb} #{count} matching job(s)." note += " Stopped at the #{JobSetBrowsing::BULK_CAP} cap — run again for more." if capped redirect_to dead_set_path, notice: note end |
#destroy ⇒ Object
20 21 22 23 24 |
# File 'app/controllers/roundhouse_ui/dead_controller.rb', line 20 def destroy entry = Sidekiq::DeadSet.new.find_job(params[:jid]) entry&.delete redirect_to dead_set_path, notice: entry ? "Deleted #{params[:jid]}." : "Job is no longer in the dead set." end |
#index ⇒ Object
7 8 9 10 11 12 |
# File 'app/controllers/roundhouse_ui/dead_controller.rb', line 7 def index @query = params[:q].to_s.strip @page = [ params[:page].to_i, 1 ].max @total = Sidekiq::DeadSet.new.size @jobs, @has_next = browse(Sidekiq::DeadSet.new, @query, @page) end |
#requeue ⇒ Object
14 15 16 17 18 |
# File 'app/controllers/roundhouse_ui/dead_controller.rb', line 14 def requeue entry = Sidekiq::DeadSet.new.find_job(params[:jid]) entry&.retry redirect_to dead_set_path, notice: entry ? "Re-enqueued #{params[:jid]}." : "Job is no longer in the dead set." end |