Sha256: 0d9b9fe60c81f1d0b2fc91ad8e1e1bc85febc870fa05a2119aad109918694937

Contents?: true

Size: 762 Bytes

Versions: 3

Compression:

Stored size: 762 Bytes

Contents

module Sidekiq
  module Monitor
    module Api
      class JobsController < ActionController::Base
        protect_from_forgery

        def index
          render json: JobsDatatable.new(view_context)
        end

        def retry
          jid = params[:jid]
          render json: {}, status: 404 and return if jid.blank?

          job = Job.find_by_jid(jid)
          render json: {}, status: 404 and return if job.blank?

          args = job.args
          worker = job.class_name.constantize
          worker.perform_async(*args)
          render json: {}, status: :ok
        end

        def clean
          cleaner = Sidekiq::Monitor::Cleaner.new
          cleaner.clean
          render json: {}, status: :ok
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sidekiq_monitor-0.0.3 app/controllers/sidekiq/monitor/api/jobs_controller.rb
sidekiq_monitor-0.0.2 app/controllers/sidekiq/monitor/api/jobs_controller.rb
sidekiq_monitor-0.0.1 app/controllers/sidekiq/monitor/api/jobs_controller.rb