Class: RoundhouseUi::BusyController

Inherits:
ApplicationController show all
Defined in:
app/controllers/roundhouse_ui/busy_controller.rb

Overview

What's executing right now, from Sidekiq::WorkSet — the live in-flight jobs Sidekiq Web calls "Busy". Surfaces long-running (possibly hung) jobs, which the stock UI makes you eyeball.

Constant Summary collapse

LONG_RUNNING =

seconds

60

Constants inherited from ApplicationController

ApplicationController::AUDIT_VERBS

Instance Method Summary collapse

Methods inherited from ApplicationController

#redirect_to

Instance Method Details

#cancelObject



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

def cancel
  RoundhouseUi::Cancellation.cancel!(params[:jid])
  redirect_to busy_path, notice: "Cancellation requested for #{params[:jid]}."
end

#indexObject



10
11
12
13
14
15
# File 'app/controllers/roundhouse_ui/busy_controller.rb', line 10

def index
  @threshold = LONG_RUNNING
  @work = Sidekiq::WorkSet.new.map do |process_id, tid, work|
    { process: process_id, tid: tid, queue: work.queue, run_at: work.run_at, job: work.job }
  end
end