Class: Flightdeck::ProcessesController

Inherits:
ApplicationController show all
Includes:
Toasts
Defined in:
app/controllers/flightdeck/processes_controller.rb

Constant Summary

Constants inherited from ApplicationController

ApplicationController::UNCONFIGURED_MESSAGE

Instance Method Summary collapse

Methods inherited from ApplicationController

host_authenticated?

Instance Method Details

#indexObject



9
10
# File 'app/controllers/flightdeck/processes_controller.rb', line 9

def index
end

#pruneObject

Pruning is Solid Queue's Process#prune: it fails the process's claimed executions with a ProcessPrunedError and deregisters the row. Flightdeck only decides whether a process may be pruned.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/flightdeck/processes_controller.rb', line 15

def prune
  node = @registry.find(params[:id])
  return missing unless node

  unless node.prunable?
    toast "#{node.kind} #{node.name} is still sending heartbeats — only unresponsive " \
          "processes can be pruned.", level: :error
    return respond_with_toast(processes_frame, fallback: processes_path)
  end

  claimed = node.claimed_count
  node.process.prune
  load_registry

  toast "Pruned #{node.kind} #{node.name}#{released(claimed)}."
  respond_with_toast processes_frame, fallback: processes_path
end