jobs: fix backwards job priorities.
Fix bug where jobs had the opposite of the intended priority. Populating saved searches had the highest priority, while processing uploads had the lowest priority. Caused by Delayed::Job and GoodJob having opposite interpretations of job priorities. In Delayed::Job, lower numbers had higher priority, while in GoodJob, higher numbers have higher priority. This was missed when migrating from Delayed::Job to GoodJob.
This commit is contained in:
@@ -11,6 +11,8 @@ class ApplicationJob < ActiveJob::Base
|
|||||||
class JobTimeoutError < StandardError; end
|
class JobTimeoutError < StandardError; end
|
||||||
|
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
|
||||||
|
# Jobs with higher priority are processed first. Higher number = higher priority.
|
||||||
queue_with_priority 0
|
queue_with_priority 0
|
||||||
|
|
||||||
around_perform do |_job, block|
|
around_perform do |_job, block|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
# A job that deletes a user's favorites when they delete their account.
|
# A job that deletes a user's favorites when they delete their account.
|
||||||
class DeleteFavoritesJob < ApplicationJob
|
class DeleteFavoritesJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
queue_with_priority 20
|
|
||||||
|
|
||||||
def perform(user)
|
def perform(user)
|
||||||
Post.without_timeout do
|
Post.without_timeout do
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
# A job that deletes a user's settings and other personal data when they delete their account.
|
# A job that deletes a user's settings and other personal data when they delete their account.
|
||||||
class DeleteUserJob < ApplicationJob
|
class DeleteUserJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
queue_with_priority 20
|
|
||||||
|
|
||||||
def perform(user)
|
def perform(user)
|
||||||
UserDeletion.new(user: user).delete_user
|
UserDeletion.new(user: user).delete_user
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# `search:all` or `search:<label>`.
|
# `search:all` or `search:<label>`.
|
||||||
class PopulateSavedSearchJob < ApplicationJob
|
class PopulateSavedSearchJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
queue_with_priority 20
|
queue_with_priority -1
|
||||||
|
|
||||||
def perform(query)
|
def perform(query)
|
||||||
SavedSearch.populate(query)
|
SavedSearch.populate(query)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ProcessUploadJob < ApplicationJob
|
class ProcessUploadJob < ApplicationJob
|
||||||
queue_with_priority -1
|
queue_with_priority 30
|
||||||
|
|
||||||
def perform(upload)
|
def perform(upload)
|
||||||
upload.process_upload!
|
upload.process_upload!
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ProcessUploadMediaAssetJob < ApplicationJob
|
class ProcessUploadMediaAssetJob < ApplicationJob
|
||||||
queue_with_priority -1
|
queue_with_priority 20
|
||||||
|
|
||||||
def perform(upload_media_asset)
|
def perform(upload_media_asset)
|
||||||
upload_media_asset.process_upload!
|
upload_media_asset.process_upload!
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
# A job that regenerates a post's images and IQDB when a moderator requests it.
|
# A job that regenerates a post's images and IQDB when a moderator requests it.
|
||||||
class RegeneratePostJob < ApplicationJob
|
class RegeneratePostJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
queue_with_priority 20
|
|
||||||
|
|
||||||
def perform(post:, category:, user:)
|
def perform(post:, category:, user:)
|
||||||
post.regenerate!(category, user)
|
post.regenerate!(category, user)
|
||||||
|
|||||||
Reference in New Issue
Block a user