Sha256: b97bb91e24d933cec6391fd9386927a53456eaa20b02e645c697bbfac0a4857c

Contents?: true

Size: 836 Bytes

Versions: 5

Compression:

Stored size: 836 Bytes

Contents

module RocketJobMissionControl
  class ActiveWorkersController < RocketJobMissionControl::ApplicationController
    def index
      @server_name = params[:server_name]
      if job_id = params[:job_id]
        @job = RocketJob::Job.find(job_id)
      end

      respond_to do |format|
        format.html
        format.json do
          # The list of workers actively processing jobs. Sorted by longest running workers first.
          active_workers =
            if @job
              @job.rocket_job_active_workers
            else
              RocketJob::ActiveWorker.all(@server_name).sort { |a, b| b.duration_s <=> a.duration_s }
            end

          query = RocketJobMissionControl::Query.new(active_workers)
          render(json: ActiveWorkersDatatable.new(view_context, query))
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rocketjob_mission_control-3.1.0 app/controllers/rocket_job_mission_control/active_workers_controller.rb
rocketjob_mission_control-3.0.3 app/controllers/rocket_job_mission_control/active_workers_controller.rb
rocketjob_mission_control-3.0.2 app/controllers/rocket_job_mission_control/active_workers_controller.rb
rocketjob_mission_control-3.0.1 app/controllers/rocket_job_mission_control/active_workers_controller.rb
rocketjob_mission_control-3.0.0 app/controllers/rocket_job_mission_control/active_workers_controller.rb