Class: RoundhouseUi::RetriesController

Inherits:
ApplicationController show all
Includes:
JobSetBrowsing
Defined in:
app/controllers/roundhouse_ui/retries_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

Methods included from JobSetBrowsing

#browse, #bulk_apply, #entry_matches?, #entry_selected?, #entry_tagged?, #entry_tags, #queue_filter, #tag_cache_for, #tag_filter

Methods inherited from ApplicationController

#redirect_to

Instance Method Details

#bulk_allObject

Smart bulk: retry/delete EVERY job matching the current filter, capped for safety. Offered only when a filter is active.



31
32
33
34
35
36
37
38
# File 'app/controllers/roundhouse_ui/retries_controller.rb', line 31

def bulk_all
  @queue_filter = queue_filter
  count, capped = bulk_apply(backend.retry_set, params[:q].to_s.strip, params[:op], BULK_CAP, tag: tag_filter)
  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 retries_path, notice: note
end

#destroyObject



23
24
25
26
27
# File 'app/controllers/roundhouse_ui/retries_controller.rb', line 23

def destroy
  entry = backend.retry_set.find_job(params[:jid])
  entry&.delete
  redirect_to retries_path, notice: entry ? "Deleted #{params[:jid]}." : "Job is no longer in the retry set."
end

#indexObject



7
8
9
10
11
12
13
14
# File 'app/controllers/roundhouse_ui/retries_controller.rb', line 7

def index
  @query = params[:q].to_s.strip
  @page  = [ params[:page].to_i, 1 ].max
  @total = backend.retry_set.size
  @tag = tag_filter
  @queue_filter = queue_filter
  @jobs, @has_next = browse(backend.retry_set, @query, @page, PER_PAGE, tag: @tag)
end

#requeueObject

Retry now — moves the job back to its queue immediately.



17
18
19
20
21
# File 'app/controllers/roundhouse_ui/retries_controller.rb', line 17

def requeue
  entry = backend.retry_set.find_job(params[:jid])
  entry&.retry
  redirect_to retries_path, notice: entry ? "Re-enqueued #{params[:jid]}." : "Job is no longer in the retry set."
end