Files
danbooru/app/jobs/application_job.rb
evazion dc159ed135 jobs: show retried jobs in /jobs listing.
Fix the /jobs listing to show retried jobs. GoodJob::ActiveJobJob has a
default scope that filters out retried jobs; remove it in the index
controller so we can see retried jobs.

Also fix mail delivery jobs not showing up in the dropdown in the /jobs
search form.
2022-01-04 17:46:54 -06:00

42 lines
1.4 KiB
Ruby

# frozen_string_literal: true
# The base class for all background jobs on Danbooru.
#
# @see https://guides.rubyonrails.org/active_job_basics.html
# @see https://github.com/bensheldon/good_job
class ApplicationJob < ActiveJob::Base
class JobTimeoutError < StandardError; end
queue_as :default
queue_with_priority 0
around_perform do |_job, block|
CurrentUser.scoped(User.system, "127.0.0.1") do
ApplicationRecord.without_timeout do
Timeout.timeout(8.hours, JobTimeoutError) do
block.call
end
end
end
end
discard_on ActiveJob::DeserializationError do |_job, error|
DanbooruLogger.log(error)
end
# A list of all available job types. Used by the /jobs search form.
def self.job_classes
[
AmcheckDatabaseJob, BigqueryExportAllJob, DeleteFavoritesJob,
DmailInactiveApproversJob, IqdbAddPostJob, IqdbRemovePostJob,
PopulateSavedSearchJob, PruneApproversJob, PruneBansJob,
PruneBulkUpdateRequestsJob, PrunePostDisapprovalsJob, PrunePostsJob,
PruneRateLimitsJob, PruneUploadsJob, RegeneratePostCountsJob,
RegeneratePostJob, RetireTagRelationshipsJob,
UploadPreprocessorDelayedStartJob, UploadServiceDelayedStartJob,
VacuumDatabaseJob, DiscordNotificationJob, BigqueryExportJob,
ProcessBulkUpdateRequestJob, PruneJobsJob, ActionMailer::MailDeliveryJob
]
end
end