worker_status_controller.rb 536 B

123456789101112
  1. class WorkerStatusController < ApplicationController
  2. def show
  3. start = Time.now.to_f
  4. render :json => {
  5. :pending => Delayed::Job.where("run_at <= ? AND locked_at IS NULL AND attempts = 0", Time.now).count,
  6. :awaiting_retry => Delayed::Job.where("failed_at IS NULL AND attempts > 0").count,
  7. :recent_failures => Delayed::Job.where("failed_at IS NOT NULL AND failed_at > ?", 5.days.ago).count,
  8. :event_count => current_user.events.count,
  9. :compute_time => Time.now.to_f - start
  10. }
  11. end
  12. end