Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Delayed job view and controller
class Admin::DelayedJobsController < AdminController
# GET /admin/delayed_jobs
def index
@delayed_jobs = Delayed::Backend::Mongoid::Job.desc(:created_at)
.paginate :page => params[:page], :per_page => 20
end
end
%h1 Delayed Jobs
= render :partial => "shared/pagination", locals: { items: @delayed_jobs }
%table
%tr
%th.small Priority
%th.small Attempts
%th.large Job
%th.medium When
%th.medium Locked
- @delayed_jobs.each do |delayed_job|
%tr{ failed: delayed_job.failed_at, failing: delayed_job.last_error && ! delayed_job.failed_at }
%td.small= "#{delayed_job.priority}"
%td.small= "#{delayed_job.attempts}"
%td.large
- if delayed_job.last_error
%div.input.inputs_form
= link_to "Error".html_safe, "javascript:return false;", :class => "more"
%div.inputs
%ul.error
= "Failed #{time_ago_in_words(delayed_job.failed_at || delayed_job.run_at)} with '#{delayed_job.last_error}'"
%div.input.inputs_form
= link_to "Details".html_safe, "javascript:return false;", :class => "more"
%div.inputs
%ul
= "#{delayed_job.handler}"
%td.medium
- if delayed_job.run_at
= "scheduled to run #{time_ago_in_words(delayed_job.run_at)} ago"
%td.medium
- if delayed_job.locked_at
= "locked #{time_ago_in_words(delayed_job.locked_at)} by #{delayed_job.locked_by}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.