Sha256: 783e729f3d8b04013ded587c98954f741417f4c3401590f2d1080e98be59166a

Contents?: true

Size: 558 Bytes

Versions: 40

Compression:

Stored size: 558 Bytes

Contents

class Marty::DelayedJobController < ActionController::Base
  def trigger
    work_off_job if delayed_job.present?
    render json: { status: :ok }, status: :ok
  end

  private

  def delayed_job
    return unless params['id'].present?

    @delayed_job ||= ::Delayed::Job.find_by(id: params['id'])
  end

  def work_off_job
    return if delayed_job.locked_at.present?

    ::Delayed::Job.where(id: delayed_job.id).
      update_all(locked_at: ::Delayed::Job.db_time_now, locked_by: 'Lambda')

    w = ::Delayed::Worker.new
    w.run(delayed_job)
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
marty-9.3.0 app/controllers/marty/delayed_job_controller.rb
marty-8.5.0 app/controllers/marty/delayed_job_controller.rb
marty-8.4.1 app/controllers/marty/delayed_job_controller.rb
marty-8.3.1 app/controllers/marty/delayed_job_controller.rb
marty-8.2.0 app/controllers/marty/delayed_job_controller.rb
marty-8.0.0 app/controllers/marty/delayed_job_controller.rb
marty-6.1.0 app/controllers/marty/delayed_job_controller.rb
marty-5.2.0 app/controllers/marty/delayed_job_controller.rb
marty-5.1.4 app/controllers/marty/delayed_job_controller.rb
marty-5.1.3 app/controllers/marty/delayed_job_controller.rb
marty-5.1.2 app/controllers/marty/delayed_job_controller.rb
marty-5.1.1 app/controllers/marty/delayed_job_controller.rb
marty-5.1.0 app/controllers/marty/delayed_job_controller.rb
marty-3.1.0 app/controllers/marty/delayed_job_controller.rb
marty-3.0.1 app/controllers/marty/delayed_job_controller.rb
marty-4.0.0.rc2 app/controllers/marty/delayed_job_controller.rb
marty-3.0.0 app/controllers/marty/delayed_job_controller.rb
marty-2.9.3 app/controllers/marty/delayed_job_controller.rb
marty-2.9.2 app/controllers/marty/delayed_job_controller.rb
marty-2.9.1 app/controllers/marty/delayed_job_controller.rb