jobs: fix failures in /jobs controller.

Fix errors with searching for and retrying jobs on the /jobs page caused
by the upgrade to GoodJob 3.0.
This commit is contained in:
evazion
2022-08-23 17:27:23 -05:00
parent df2d13d42e
commit c8917684b8
4 changed files with 14 additions and 11 deletions

View File

@@ -3,6 +3,6 @@
# A job that runs daily to delete all stale jobs. Spawned by {DanbooruMaintenance}.
class PruneJobsJob < ApplicationJob
def perform
GoodJob::ActiveJobJob.where("created_at < ?", 7.days.ago).destroy_all
BackgroundJob.where("created_at < ?", 7.days.ago).destroy_all
end
end

View File

@@ -1,12 +1,10 @@
# frozen_string_literal: true
# A BackgroundJob is a job in the good_jobs table. This class is simply an
# extension of GoodJob::ActiveJobJob, with a few extra methods for searching jobs.
# extension of GoodJob::Job, with a few extra methods for searching jobs.
#
# @see https://github.com/bensheldon/good_job/blob/main/lib/good_job/active_job_job.rb
class BackgroundJob < GoodJob::ActiveJobJob
delegate :executions_count, to: :job
# @see https://github.com/bensheldon/good_job
class BackgroundJob < GoodJob::Job
concerning :SearchMethods do
class_methods do
def default_order
@@ -62,7 +60,7 @@ class BackgroundJob < GoodJob::ActiveJobJob
end
def pretty_name
job.job_class.titleize.delete_suffix(" Job")
job_class.titleize.delete_suffix(" Job")
end
end
end