Class: RoundhouseUi::DeadController

Inherits:
ApplicationController show all
Includes:
JobSetBrowsing
Defined in:
app/controllers/roundhouse_ui/dead_controller.rb

Constant Summary

Constants included from JobSetBrowsing

JobSetBrowsing::PER_PAGE

Constants inherited from ApplicationController

ApplicationController::AUDIT_VERBS

Instance Method Summary collapse

Methods included from JobSetBrowsing

#browse, #entry_matches?

Methods inherited from ApplicationController

#redirect_to

Instance Method Details

#bulkObject

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

#destroyObject



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

#indexObject



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

#requeueObject



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