Skip to content

Instantly share code, notes, and snippets.

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
%h1 Delayed Jobs
= render :partial => "shared/pagination", locals: { items: @delayed_jobs }
%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}"
- if delayed_job.last_error
= link_to "Error".html_safe, "javascript:return false;", :class => "more"
= "Failed #{time_ago_in_words(delayed_job.failed_at || delayed_job.run_at)} with '#{delayed_job.last_error}'"
= link_to "Details".html_safe, "javascript:return false;", :class => "more"
= "#{delayed_job.handler}"
- if delayed_job.run_at
= "scheduled to run #{time_ago_in_words(delayed_job.run_at)} ago"
- 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