From 4f8bf2b0cd76555087ffd57a9fedf1735810257e Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 25 Mar 2024 11:44:39 -0400 Subject: [PATCH] Add `ApplicationWorker` base class for workers --- app/workers/account_deletion_worker.rb | 4 +--- app/workers/account_merging_worker.rb | 4 +--- app/workers/account_refresh_worker.rb | 4 +--- app/workers/activitypub/delivery_worker.rb | 3 +-- app/workers/activitypub/distribute_poll_update_worker.rb | 3 +-- app/workers/activitypub/fetch_replies_worker.rb | 3 +-- .../activitypub/followers_synchronization_worker.rb | 4 +--- app/workers/activitypub/move_distribution_worker.rb | 3 +-- app/workers/activitypub/post_upgrade_worker.rb | 4 +--- app/workers/activitypub/processing_worker.rb | 4 +--- app/workers/activitypub/raw_distribution_worker.rb | 3 +-- .../synchronize_featured_collection_worker.rb | 4 +--- .../synchronize_featured_tags_collection_worker.rb | 4 +--- app/workers/add_to_public_statuses_index_worker.rb | 3 +-- app/workers/admin/account_deletion_worker.rb | 4 +--- app/workers/admin/domain_purge_worker.rb | 4 +--- app/workers/admin/suspension_worker.rb | 4 +--- app/workers/admin/unsuspension_worker.rb | 4 +--- app/workers/after_account_domain_block_worker.rb | 4 +--- app/workers/after_unallow_domain_worker.rb | 4 +--- app/workers/application_worker.rb | 9 +++++++++ app/workers/authorize_follow_worker.rb | 4 +--- app/workers/backup_worker.rb | 4 +--- app/workers/block_worker.rb | 4 +--- app/workers/bootstrap_timeline_worker.rb | 4 +--- app/workers/bulk_import_worker.rb | 4 +--- app/workers/cache_buster_worker.rb | 3 +-- app/workers/delete_mute_worker.rb | 4 +--- app/workers/distribution_worker.rb | 3 +-- app/workers/domain_block_worker.rb | 4 +--- app/workers/domain_clear_media_worker.rb | 4 +--- app/workers/feed_insert_worker.rb | 3 +-- app/workers/fetch_reply_worker.rb | 3 +-- app/workers/generate_annual_report_worker.rb | 4 +--- app/workers/import/relationship_worker.rb | 4 +--- app/workers/import/row_worker.rb | 4 +--- app/workers/import_worker.rb | 4 +--- app/workers/link_crawl_worker.rb | 4 +--- app/workers/local_notification_worker.rb | 4 +--- app/workers/merge_worker.rb | 3 +-- app/workers/move_worker.rb | 4 +--- app/workers/mute_worker.rb | 4 +--- app/workers/poll_expiration_notify_worker.rb | 4 +--- app/workers/post_process_media_worker.rb | 4 +--- app/workers/publish_announcement_reaction_worker.rb | 3 +-- app/workers/publish_scheduled_announcement_worker.rb | 3 +-- app/workers/publish_scheduled_status_worker.rb | 4 +--- app/workers/push_conversation_worker.rb | 3 +-- app/workers/push_encrypted_message_worker.rb | 3 +-- app/workers/push_update_worker.rb | 3 +-- app/workers/redownload_avatar_worker.rb | 3 +-- app/workers/redownload_header_worker.rb | 3 +-- app/workers/redownload_media_worker.rb | 3 +-- app/workers/refollow_worker.rb | 4 +--- app/workers/regeneration_worker.rb | 3 +-- app/workers/remote_account_refresh_worker.rb | 3 +-- app/workers/removal_worker.rb | 4 +--- app/workers/remove_featured_tag_worker.rb | 4 +--- app/workers/remove_from_public_statuses_index_worker.rb | 4 +--- app/workers/resolve_account_worker.rb | 4 +--- .../scheduler/accounts_statuses_cleanup_scheduler.rb | 3 +-- .../scheduler/auto_close_registrations_scheduler.rb | 3 +-- .../scheduler/follow_recommendations_scheduler.rb | 4 +--- app/workers/scheduler/indexing_scheduler.rb | 3 +-- app/workers/scheduler/instance_refresh_scheduler.rb | 4 +--- app/workers/scheduler/ip_cleanup_scheduler.rb | 4 +--- app/workers/scheduler/pghero_scheduler.rb | 4 +--- app/workers/scheduler/scheduled_statuses_scheduler.rb | 4 +--- app/workers/scheduler/self_destruct_scheduler.rb | 3 +-- app/workers/scheduler/software_update_check_scheduler.rb | 4 +--- .../scheduler/suspended_user_cleanup_scheduler.rb | 4 +--- app/workers/scheduler/trends/refresh_scheduler.rb | 4 +--- .../scheduler/trends/review_notifications_scheduler.rb | 4 +--- app/workers/scheduler/user_cleanup_scheduler.rb | 2 +- app/workers/scheduler/vacuum_scheduler.rb | 4 +--- app/workers/tag_unmerge_worker.rb | 3 +-- app/workers/thread_resolve_worker.rb | 3 +-- app/workers/trigger_webhook_worker.rb | 4 +--- app/workers/unfavourite_worker.rb | 4 +--- app/workers/unfilter_notifications_worker.rb | 4 +--- app/workers/unfollow_follow_worker.rb | 4 +--- app/workers/unmerge_worker.rb | 3 +-- app/workers/unpublish_announcement_worker.rb | 3 +-- app/workers/verify_account_links_worker.rb | 4 +--- app/workers/web/push_notification_worker.rb | 4 +--- app/workers/webhooks/delivery_worker.rb | 3 +-- 86 files changed, 94 insertions(+), 223 deletions(-) create mode 100644 app/workers/application_worker.rb diff --git a/app/workers/account_deletion_worker.rb b/app/workers/account_deletion_worker.rb index 070352f9572..9bce960be67 100644 --- a/app/workers/account_deletion_worker.rb +++ b/app/workers/account_deletion_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class AccountDeletionWorker - include Sidekiq::Worker - +class AccountDeletionWorker < ApplicationWorker sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i def perform(account_id, options = {}) diff --git a/app/workers/account_merging_worker.rb b/app/workers/account_merging_worker.rb index 8c234e7acf1..915f6cdf658 100644 --- a/app/workers/account_merging_worker.rb +++ b/app/workers/account_merging_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class AccountMergingWorker - include Sidekiq::Worker - +class AccountMergingWorker < ApplicationWorker sidekiq_options queue: 'pull' def perform(account_id) diff --git a/app/workers/account_refresh_worker.rb b/app/workers/account_refresh_worker.rb index 08b5bab8da6..f38eb465a01 100644 --- a/app/workers/account_refresh_worker.rb +++ b/app/workers/account_refresh_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class AccountRefreshWorker - include Sidekiq::Worker - +class AccountRefreshWorker < ApplicationWorker sidekiq_options queue: 'pull', retry: 3, dead: false, lock: :until_executed, lock_ttl: 1.day.to_i def perform(account_id) diff --git a/app/workers/activitypub/delivery_worker.rb b/app/workers/activitypub/delivery_worker.rb index 0c6ca026bba..d70479cb71d 100644 --- a/app/workers/activitypub/delivery_worker.rb +++ b/app/workers/activitypub/delivery_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class ActivityPub::DeliveryWorker - include Sidekiq::Worker +class ActivityPub::DeliveryWorker < ApplicationWorker include RoutingHelper include JsonLdHelper diff --git a/app/workers/activitypub/distribute_poll_update_worker.rb b/app/workers/activitypub/distribute_poll_update_worker.rb index 8c1eefd93d5..9174d5876f7 100644 --- a/app/workers/activitypub/distribute_poll_update_worker.rb +++ b/app/workers/activitypub/distribute_poll_update_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class ActivityPub::DistributePollUpdateWorker - include Sidekiq::Worker +class ActivityPub::DistributePollUpdateWorker < ApplicationWorker include Payloadable sidekiq_options queue: 'push', lock: :until_executed, retry: 0 diff --git a/app/workers/activitypub/fetch_replies_worker.rb b/app/workers/activitypub/fetch_replies_worker.rb index d72bad74526..8f8c0eadfcf 100644 --- a/app/workers/activitypub/fetch_replies_worker.rb +++ b/app/workers/activitypub/fetch_replies_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class ActivityPub::FetchRepliesWorker - include Sidekiq::Worker +class ActivityPub::FetchRepliesWorker < ApplicationWorker include ExponentialBackoff sidekiq_options queue: 'pull', retry: 3 diff --git a/app/workers/activitypub/followers_synchronization_worker.rb b/app/workers/activitypub/followers_synchronization_worker.rb index 35a3ef0b967..4665e251e4c 100644 --- a/app/workers/activitypub/followers_synchronization_worker.rb +++ b/app/workers/activitypub/followers_synchronization_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class ActivityPub::FollowersSynchronizationWorker - include Sidekiq::Worker - +class ActivityPub::FollowersSynchronizationWorker < ApplicationWorker sidekiq_options queue: 'push', lock: :until_executed def perform(account_id, url) diff --git a/app/workers/activitypub/move_distribution_worker.rb b/app/workers/activitypub/move_distribution_worker.rb index 1680fcc76ec..9343321eaed 100644 --- a/app/workers/activitypub/move_distribution_worker.rb +++ b/app/workers/activitypub/move_distribution_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class ActivityPub::MoveDistributionWorker - include Sidekiq::Worker +class ActivityPub::MoveDistributionWorker < ApplicationWorker include Payloadable sidekiq_options queue: 'push' diff --git a/app/workers/activitypub/post_upgrade_worker.rb b/app/workers/activitypub/post_upgrade_worker.rb index 4154b8582b0..7475a7c3b42 100644 --- a/app/workers/activitypub/post_upgrade_worker.rb +++ b/app/workers/activitypub/post_upgrade_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class ActivityPub::PostUpgradeWorker - include Sidekiq::Worker - +class ActivityPub::PostUpgradeWorker < ApplicationWorker sidekiq_options queue: 'pull' def perform(domain) diff --git a/app/workers/activitypub/processing_worker.rb b/app/workers/activitypub/processing_worker.rb index 1bb94b7f264..ed328e3d056 100644 --- a/app/workers/activitypub/processing_worker.rb +++ b/app/workers/activitypub/processing_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class ActivityPub::ProcessingWorker - include Sidekiq::Worker - +class ActivityPub::ProcessingWorker < ApplicationWorker sidekiq_options queue: 'ingress', backtrace: true, retry: 8 def perform(actor_id, body, delivered_to_account_id = nil, actor_type = 'Account') diff --git a/app/workers/activitypub/raw_distribution_worker.rb b/app/workers/activitypub/raw_distribution_worker.rb index c77821e0f14..15450e5b0d1 100644 --- a/app/workers/activitypub/raw_distribution_worker.rb +++ b/app/workers/activitypub/raw_distribution_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class ActivityPub::RawDistributionWorker - include Sidekiq::Worker +class ActivityPub::RawDistributionWorker < ApplicationWorker include Payloadable sidekiq_options queue: 'push' diff --git a/app/workers/activitypub/synchronize_featured_collection_worker.rb b/app/workers/activitypub/synchronize_featured_collection_worker.rb index 7a187d7f53e..9f4c8775520 100644 --- a/app/workers/activitypub/synchronize_featured_collection_worker.rb +++ b/app/workers/activitypub/synchronize_featured_collection_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class ActivityPub::SynchronizeFeaturedCollectionWorker - include Sidekiq::Worker - +class ActivityPub::SynchronizeFeaturedCollectionWorker < ApplicationWorker sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.day.to_i def perform(account_id, options = {}) diff --git a/app/workers/activitypub/synchronize_featured_tags_collection_worker.rb b/app/workers/activitypub/synchronize_featured_tags_collection_worker.rb index 570415c8214..9a0e19f8581 100644 --- a/app/workers/activitypub/synchronize_featured_tags_collection_worker.rb +++ b/app/workers/activitypub/synchronize_featured_tags_collection_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class ActivityPub::SynchronizeFeaturedTagsCollectionWorker - include Sidekiq::Worker - +class ActivityPub::SynchronizeFeaturedTagsCollectionWorker < ApplicationWorker sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.day.to_i def perform(account_id, url) diff --git a/app/workers/add_to_public_statuses_index_worker.rb b/app/workers/add_to_public_statuses_index_worker.rb index 80d921eab04..d32637217e7 100644 --- a/app/workers/add_to_public_statuses_index_worker.rb +++ b/app/workers/add_to_public_statuses_index_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class AddToPublicStatusesIndexWorker - include Sidekiq::Worker +class AddToPublicStatusesIndexWorker < ApplicationWorker include DatabaseHelper sidekiq_options queue: 'pull' diff --git a/app/workers/admin/account_deletion_worker.rb b/app/workers/admin/account_deletion_worker.rb index 5dfdfb6e73c..a3a6f8bf83b 100644 --- a/app/workers/admin/account_deletion_worker.rb +++ b/app/workers/admin/account_deletion_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Admin::AccountDeletionWorker - include Sidekiq::Worker - +class Admin::AccountDeletionWorker < ApplicationWorker sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i def perform(account_id) diff --git a/app/workers/admin/domain_purge_worker.rb b/app/workers/admin/domain_purge_worker.rb index 6c5250b660c..f54558aa405 100644 --- a/app/workers/admin/domain_purge_worker.rb +++ b/app/workers/admin/domain_purge_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Admin::DomainPurgeWorker - include Sidekiq::Worker - +class Admin::DomainPurgeWorker < ApplicationWorker sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i def perform(domain) diff --git a/app/workers/admin/suspension_worker.rb b/app/workers/admin/suspension_worker.rb index 35c57033609..8065b0128f5 100644 --- a/app/workers/admin/suspension_worker.rb +++ b/app/workers/admin/suspension_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Admin::SuspensionWorker - include Sidekiq::Worker - +class Admin::SuspensionWorker < ApplicationWorker sidekiq_options queue: 'pull' def perform(account_id) diff --git a/app/workers/admin/unsuspension_worker.rb b/app/workers/admin/unsuspension_worker.rb index 7cb2349b16b..7949ad585f5 100644 --- a/app/workers/admin/unsuspension_worker.rb +++ b/app/workers/admin/unsuspension_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Admin::UnsuspensionWorker - include Sidekiq::Worker - +class Admin::UnsuspensionWorker < ApplicationWorker sidekiq_options queue: 'pull' def perform(account_id) diff --git a/app/workers/after_account_domain_block_worker.rb b/app/workers/after_account_domain_block_worker.rb index 043c333117b..e16fc758cf2 100644 --- a/app/workers/after_account_domain_block_worker.rb +++ b/app/workers/after_account_domain_block_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class AfterAccountDomainBlockWorker - include Sidekiq::Worker - +class AfterAccountDomainBlockWorker < ApplicationWorker def perform(account_id, domain) AfterBlockDomainFromAccountService.new.call(Account.find(account_id), domain) rescue ActiveRecord::RecordNotFound diff --git a/app/workers/after_unallow_domain_worker.rb b/app/workers/after_unallow_domain_worker.rb index 46049cbb2e0..307e30a2b1d 100644 --- a/app/workers/after_unallow_domain_worker.rb +++ b/app/workers/after_unallow_domain_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class AfterUnallowDomainWorker - include Sidekiq::Worker - +class AfterUnallowDomainWorker < ApplicationWorker def perform(domain) AfterUnallowDomainService.new.call(domain) end diff --git a/app/workers/application_worker.rb b/app/workers/application_worker.rb new file mode 100644 index 00000000000..8cec73b792f --- /dev/null +++ b/app/workers/application_worker.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class ApplicationWorker + include Sidekiq::Worker + + def perform(*) + raise NotImplementedError + end +end diff --git a/app/workers/authorize_follow_worker.rb b/app/workers/authorize_follow_worker.rb index f57900fa59a..fcd52a4c238 100644 --- a/app/workers/authorize_follow_worker.rb +++ b/app/workers/authorize_follow_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class AuthorizeFollowWorker - include Sidekiq::Worker - +class AuthorizeFollowWorker < ApplicationWorker def perform(source_account_id, target_account_id) source_account = Account.find(source_account_id) target_account = Account.find(target_account_id) diff --git a/app/workers/backup_worker.rb b/app/workers/backup_worker.rb index df933142ae4..06cbf8fab55 100644 --- a/app/workers/backup_worker.rb +++ b/app/workers/backup_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class BackupWorker - include Sidekiq::Worker - +class BackupWorker < ApplicationWorker sidekiq_options queue: 'pull', backtrace: true, retry: 5, dead: false sidekiq_retries_exhausted do |msg| diff --git a/app/workers/block_worker.rb b/app/workers/block_worker.rb index 25f5dd808fd..e33fc703a48 100644 --- a/app/workers/block_worker.rb +++ b/app/workers/block_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class BlockWorker - include Sidekiq::Worker - +class BlockWorker < ApplicationWorker def perform(account_id, target_account_id) AfterBlockService.new.call( Account.find(account_id), diff --git a/app/workers/bootstrap_timeline_worker.rb b/app/workers/bootstrap_timeline_worker.rb index 89cfb4c3ae4..307f38662c3 100644 --- a/app/workers/bootstrap_timeline_worker.rb +++ b/app/workers/bootstrap_timeline_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class BootstrapTimelineWorker - include Sidekiq::Worker - +class BootstrapTimelineWorker < ApplicationWorker def perform(account_id) BootstrapTimelineService.new.call(Account.find(account_id)) end diff --git a/app/workers/bulk_import_worker.rb b/app/workers/bulk_import_worker.rb index 54571a95c00..f8e6a2cb997 100644 --- a/app/workers/bulk_import_worker.rb +++ b/app/workers/bulk_import_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class BulkImportWorker - include Sidekiq::Worker - +class BulkImportWorker < ApplicationWorker sidekiq_options queue: 'pull', retry: false def perform(import_id) diff --git a/app/workers/cache_buster_worker.rb b/app/workers/cache_buster_worker.rb index 5ad0a44cb7a..5de031e7545 100644 --- a/app/workers/cache_buster_worker.rb +++ b/app/workers/cache_buster_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class CacheBusterWorker - include Sidekiq::Worker +class CacheBusterWorker < ApplicationWorker include RoutingHelper sidekiq_options queue: 'pull' diff --git a/app/workers/delete_mute_worker.rb b/app/workers/delete_mute_worker.rb index eb031020e1b..e76951ed31e 100644 --- a/app/workers/delete_mute_worker.rb +++ b/app/workers/delete_mute_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class DeleteMuteWorker - include Sidekiq::Worker - +class DeleteMuteWorker < ApplicationWorker def perform(mute_id) mute = Mute.find_by(id: mute_id) UnmuteService.new.call(mute.account, mute.target_account) if mute&.expired? diff --git a/app/workers/distribution_worker.rb b/app/workers/distribution_worker.rb index 1d58e53e941..2b39ba1c515 100644 --- a/app/workers/distribution_worker.rb +++ b/app/workers/distribution_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class DistributionWorker - include Sidekiq::Worker +class DistributionWorker < ApplicationWorker include Redisable include Lockable diff --git a/app/workers/domain_block_worker.rb b/app/workers/domain_block_worker.rb index 3c601cd8321..d1e18cea3fc 100644 --- a/app/workers/domain_block_worker.rb +++ b/app/workers/domain_block_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class DomainBlockWorker - include Sidekiq::Worker - +class DomainBlockWorker < ApplicationWorker def perform(domain_block_id, update = false) domain_block = DomainBlock.find_by(id: domain_block_id) return true if domain_block.nil? diff --git a/app/workers/domain_clear_media_worker.rb b/app/workers/domain_clear_media_worker.rb index 971934a0882..ba63f5c4fb4 100644 --- a/app/workers/domain_clear_media_worker.rb +++ b/app/workers/domain_clear_media_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class DomainClearMediaWorker - include Sidekiq::Worker - +class DomainClearMediaWorker < ApplicationWorker sidekiq_options queue: 'pull' def perform(domain_block_id) diff --git a/app/workers/feed_insert_worker.rb b/app/workers/feed_insert_worker.rb index fd7dbd30dab..4f07bcfa748 100644 --- a/app/workers/feed_insert_worker.rb +++ b/app/workers/feed_insert_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class FeedInsertWorker - include Sidekiq::Worker +class FeedInsertWorker < ApplicationWorker include DatabaseHelper def perform(status_id, id, type = 'home', options = {}) diff --git a/app/workers/fetch_reply_worker.rb b/app/workers/fetch_reply_worker.rb index 68a7414bebe..5ae27049165 100644 --- a/app/workers/fetch_reply_worker.rb +++ b/app/workers/fetch_reply_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class FetchReplyWorker - include Sidekiq::Worker +class FetchReplyWorker < ApplicationWorker include ExponentialBackoff sidekiq_options queue: 'pull', retry: 3 diff --git a/app/workers/generate_annual_report_worker.rb b/app/workers/generate_annual_report_worker.rb index 7094c1ab9c7..d259ef47c52 100644 --- a/app/workers/generate_annual_report_worker.rb +++ b/app/workers/generate_annual_report_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class GenerateAnnualReportWorker - include Sidekiq::Worker - +class GenerateAnnualReportWorker < ApplicationWorker def perform(account_id, year) AnnualReport.new(Account.find(account_id), year).generate rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordNotUnique diff --git a/app/workers/import/relationship_worker.rb b/app/workers/import/relationship_worker.rb index 2298b095a77..7c064f3ef66 100644 --- a/app/workers/import/relationship_worker.rb +++ b/app/workers/import/relationship_worker.rb @@ -3,9 +3,7 @@ # NOTE: This is a deprecated worker, only kept to not break ongoing imports # on upgrade. See `Import::RowWorker` for its replacement. -class Import::RelationshipWorker - include Sidekiq::Worker - +class Import::RelationshipWorker < ApplicationWorker sidekiq_options queue: 'pull', retry: 8, dead: false def perform(account_id, target_account_uri, relationship, options) diff --git a/app/workers/import/row_worker.rb b/app/workers/import/row_worker.rb index c86900e6adc..15c0b06a65f 100644 --- a/app/workers/import/row_worker.rb +++ b/app/workers/import/row_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Import::RowWorker - include Sidekiq::Worker - +class Import::RowWorker < ApplicationWorker sidekiq_options queue: 'pull', retry: 6, dead: false sidekiq_retries_exhausted do |msg, _exception| diff --git a/app/workers/import_worker.rb b/app/workers/import_worker.rb index b6afb972a96..7200d2be80b 100644 --- a/app/workers/import_worker.rb +++ b/app/workers/import_worker.rb @@ -3,9 +3,7 @@ # NOTE: This is a deprecated worker, only kept to not break ongoing imports # on upgrade. See `ImportWorker` for its replacement. -class ImportWorker - include Sidekiq::Worker - +class ImportWorker < ApplicationWorker sidekiq_options queue: 'pull', retry: false def perform(import_id) diff --git a/app/workers/link_crawl_worker.rb b/app/workers/link_crawl_worker.rb index c63af1e43aa..37b3cf13829 100644 --- a/app/workers/link_crawl_worker.rb +++ b/app/workers/link_crawl_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class LinkCrawlWorker - include Sidekiq::Worker - +class LinkCrawlWorker < ApplicationWorker sidekiq_options queue: 'pull', retry: 0 def perform(status_id) diff --git a/app/workers/local_notification_worker.rb b/app/workers/local_notification_worker.rb index 749a54b73b0..4da3a5301a3 100644 --- a/app/workers/local_notification_worker.rb +++ b/app/workers/local_notification_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class LocalNotificationWorker - include Sidekiq::Worker - +class LocalNotificationWorker < ApplicationWorker def perform(receiver_account_id, activity_id = nil, activity_class_name = nil, type = nil) if activity_id.nil? && activity_class_name.nil? activity = Mention.find(receiver_account_id) diff --git a/app/workers/merge_worker.rb b/app/workers/merge_worker.rb index 8e1614ad21b..38adf0f09b1 100644 --- a/app/workers/merge_worker.rb +++ b/app/workers/merge_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class MergeWorker - include Sidekiq::Worker +class MergeWorker < ApplicationWorker include Redisable include DatabaseHelper diff --git a/app/workers/move_worker.rb b/app/workers/move_worker.rb index a18f38556bb..83b093289c6 100644 --- a/app/workers/move_worker.rb +++ b/app/workers/move_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class MoveWorker - include Sidekiq::Worker - +class MoveWorker < ApplicationWorker def perform(source_account_id, target_account_id) @source_account = Account.find(source_account_id) @target_account = Account.find(target_account_id) diff --git a/app/workers/mute_worker.rb b/app/workers/mute_worker.rb index c74f657cbac..7f7f67fc4a5 100644 --- a/app/workers/mute_worker.rb +++ b/app/workers/mute_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class MuteWorker - include Sidekiq::Worker - +class MuteWorker < ApplicationWorker def perform(account_id, target_account_id) FeedManager.instance.clear_from_home(Account.find(account_id), Account.find(target_account_id)) rescue ActiveRecord::RecordNotFound diff --git a/app/workers/poll_expiration_notify_worker.rb b/app/workers/poll_expiration_notify_worker.rb index b7a60fab847..a5fc309191b 100644 --- a/app/workers/poll_expiration_notify_worker.rb +++ b/app/workers/poll_expiration_notify_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class PollExpirationNotifyWorker - include Sidekiq::Worker - +class PollExpirationNotifyWorker < ApplicationWorker sidekiq_options lock: :until_executing def perform(poll_id) diff --git a/app/workers/post_process_media_worker.rb b/app/workers/post_process_media_worker.rb index 2d11b00c200..bdb04f807cd 100644 --- a/app/workers/post_process_media_worker.rb +++ b/app/workers/post_process_media_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class PostProcessMediaWorker - include Sidekiq::Worker - +class PostProcessMediaWorker < ApplicationWorker sidekiq_options retry: 1, dead: false sidekiq_retries_exhausted do |msg| diff --git a/app/workers/publish_announcement_reaction_worker.rb b/app/workers/publish_announcement_reaction_worker.rb index 03da56550aa..4b8376fa872 100644 --- a/app/workers/publish_announcement_reaction_worker.rb +++ b/app/workers/publish_announcement_reaction_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class PublishAnnouncementReactionWorker - include Sidekiq::Worker +class PublishAnnouncementReactionWorker < ApplicationWorker include Redisable def perform(announcement_id, name) diff --git a/app/workers/publish_scheduled_announcement_worker.rb b/app/workers/publish_scheduled_announcement_worker.rb index c23eae6af7c..0ee585468f9 100644 --- a/app/workers/publish_scheduled_announcement_worker.rb +++ b/app/workers/publish_scheduled_announcement_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class PublishScheduledAnnouncementWorker - include Sidekiq::Worker +class PublishScheduledAnnouncementWorker < ApplicationWorker include Redisable def perform(announcement_id) diff --git a/app/workers/publish_scheduled_status_worker.rb b/app/workers/publish_scheduled_status_worker.rb index aa5c4a834a0..247e6b12849 100644 --- a/app/workers/publish_scheduled_status_worker.rb +++ b/app/workers/publish_scheduled_status_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class PublishScheduledStatusWorker - include Sidekiq::Worker - +class PublishScheduledStatusWorker < ApplicationWorker sidekiq_options lock: :until_executed, lock_ttl: 1.hour.to_i def perform(scheduled_status_id) diff --git a/app/workers/push_conversation_worker.rb b/app/workers/push_conversation_worker.rb index 23b1469f111..a5153b105e9 100644 --- a/app/workers/push_conversation_worker.rb +++ b/app/workers/push_conversation_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class PushConversationWorker - include Sidekiq::Worker +class PushConversationWorker < ApplicationWorker include Redisable def perform(conversation_account_id) diff --git a/app/workers/push_encrypted_message_worker.rb b/app/workers/push_encrypted_message_worker.rb index 6bee12675b0..eafea32cd1a 100644 --- a/app/workers/push_encrypted_message_worker.rb +++ b/app/workers/push_encrypted_message_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class PushEncryptedMessageWorker - include Sidekiq::Worker +class PushEncryptedMessageWorker < ApplicationWorker include Redisable def perform(encrypted_message_id) diff --git a/app/workers/push_update_worker.rb b/app/workers/push_update_worker.rb index c32975a986c..6850dce6fa0 100644 --- a/app/workers/push_update_worker.rb +++ b/app/workers/push_update_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class PushUpdateWorker - include Sidekiq::Worker +class PushUpdateWorker < ApplicationWorker include Redisable def perform(account_id, status_id, timeline_id = nil, options = {}) diff --git a/app/workers/redownload_avatar_worker.rb b/app/workers/redownload_avatar_worker.rb index df17b7718dc..9384cbb7a39 100644 --- a/app/workers/redownload_avatar_worker.rb +++ b/app/workers/redownload_avatar_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class RedownloadAvatarWorker - include Sidekiq::Worker +class RedownloadAvatarWorker < ApplicationWorker include ExponentialBackoff include JsonLdHelper diff --git a/app/workers/redownload_header_worker.rb b/app/workers/redownload_header_worker.rb index 3b142ec5f98..b73ac968fab 100644 --- a/app/workers/redownload_header_worker.rb +++ b/app/workers/redownload_header_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class RedownloadHeaderWorker - include Sidekiq::Worker +class RedownloadHeaderWorker < ApplicationWorker include ExponentialBackoff include JsonLdHelper diff --git a/app/workers/redownload_media_worker.rb b/app/workers/redownload_media_worker.rb index 343caa32c23..57219bfe6d5 100644 --- a/app/workers/redownload_media_worker.rb +++ b/app/workers/redownload_media_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class RedownloadMediaWorker - include Sidekiq::Worker +class RedownloadMediaWorker < ApplicationWorker include ExponentialBackoff include JsonLdHelper diff --git a/app/workers/refollow_worker.rb b/app/workers/refollow_worker.rb index 4b712d3aaeb..cef9d646754 100644 --- a/app/workers/refollow_worker.rb +++ b/app/workers/refollow_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class RefollowWorker - include Sidekiq::Worker - +class RefollowWorker < ApplicationWorker sidekiq_options queue: 'pull', retry: false def perform(target_account_id) diff --git a/app/workers/regeneration_worker.rb b/app/workers/regeneration_worker.rb index 4228f897d31..5f63bcdbdb3 100644 --- a/app/workers/regeneration_worker.rb +++ b/app/workers/regeneration_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class RegenerationWorker - include Sidekiq::Worker +class RegenerationWorker < ApplicationWorker include DatabaseHelper sidekiq_options lock: :until_executed diff --git a/app/workers/remote_account_refresh_worker.rb b/app/workers/remote_account_refresh_worker.rb index 9632936b547..052cc823a98 100644 --- a/app/workers/remote_account_refresh_worker.rb +++ b/app/workers/remote_account_refresh_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class RemoteAccountRefreshWorker - include Sidekiq::Worker +class RemoteAccountRefreshWorker < ApplicationWorker include ExponentialBackoff include JsonLdHelper diff --git a/app/workers/removal_worker.rb b/app/workers/removal_worker.rb index 2a1eaa89b06..a4ff97aa921 100644 --- a/app/workers/removal_worker.rb +++ b/app/workers/removal_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class RemovalWorker - include Sidekiq::Worker - +class RemovalWorker < ApplicationWorker def perform(status_id, options = {}) RemoveStatusService.new.call(Status.with_discarded.find(status_id), **options.symbolize_keys) rescue ActiveRecord::RecordNotFound diff --git a/app/workers/remove_featured_tag_worker.rb b/app/workers/remove_featured_tag_worker.rb index 065ec79d816..bcc24feb401 100644 --- a/app/workers/remove_featured_tag_worker.rb +++ b/app/workers/remove_featured_tag_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class RemoveFeaturedTagWorker - include Sidekiq::Worker - +class RemoveFeaturedTagWorker < ApplicationWorker def perform(account_id, featured_tag_id) RemoveFeaturedTagService.new.call(Account.find(account_id), FeaturedTag.find(featured_tag_id)) rescue ActiveRecord::RecordNotFound diff --git a/app/workers/remove_from_public_statuses_index_worker.rb b/app/workers/remove_from_public_statuses_index_worker.rb index e108a5c2096..22fc51de59f 100644 --- a/app/workers/remove_from_public_statuses_index_worker.rb +++ b/app/workers/remove_from_public_statuses_index_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class RemoveFromPublicStatusesIndexWorker - include Sidekiq::Worker - +class RemoveFromPublicStatusesIndexWorker < ApplicationWorker def perform(account_id) account = Account.find(account_id) diff --git a/app/workers/resolve_account_worker.rb b/app/workers/resolve_account_worker.rb index 4ae2442af52..2661feddf00 100644 --- a/app/workers/resolve_account_worker.rb +++ b/app/workers/resolve_account_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class ResolveAccountWorker - include Sidekiq::Worker - +class ResolveAccountWorker < ApplicationWorker sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.day.to_i def perform(uri) diff --git a/app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb b/app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb index a2ab31cc5d4..48246d6513a 100644 --- a/app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb +++ b/app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class Scheduler::AccountsStatusesCleanupScheduler - include Sidekiq::Worker +class Scheduler::AccountsStatusesCleanupScheduler < ApplicationWorker include Redisable # This limit is mostly to be nice to the fediverse at large and not diff --git a/app/workers/scheduler/auto_close_registrations_scheduler.rb b/app/workers/scheduler/auto_close_registrations_scheduler.rb index 68745029150..929af5661f2 100644 --- a/app/workers/scheduler/auto_close_registrations_scheduler.rb +++ b/app/workers/scheduler/auto_close_registrations_scheduler.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class Scheduler::AutoCloseRegistrationsScheduler - include Sidekiq::Worker +class Scheduler::AutoCloseRegistrationsScheduler < ApplicationWorker include Redisable sidekiq_options retry: 0 diff --git a/app/workers/scheduler/follow_recommendations_scheduler.rb b/app/workers/scheduler/follow_recommendations_scheduler.rb index ea5aa8b5396..dde1e92c88e 100644 --- a/app/workers/scheduler/follow_recommendations_scheduler.rb +++ b/app/workers/scheduler/follow_recommendations_scheduler.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Scheduler::FollowRecommendationsScheduler - include Sidekiq::Worker - +class Scheduler::FollowRecommendationsScheduler < ApplicationWorker sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.day.to_i def perform diff --git a/app/workers/scheduler/indexing_scheduler.rb b/app/workers/scheduler/indexing_scheduler.rb index f52d0141d47..ae174ce1d9a 100644 --- a/app/workers/scheduler/indexing_scheduler.rb +++ b/app/workers/scheduler/indexing_scheduler.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class Scheduler::IndexingScheduler - include Sidekiq::Worker +class Scheduler::IndexingScheduler < ApplicationWorker include Redisable include DatabaseHelper diff --git a/app/workers/scheduler/instance_refresh_scheduler.rb b/app/workers/scheduler/instance_refresh_scheduler.rb index 818682a5d21..0e808c4178b 100644 --- a/app/workers/scheduler/instance_refresh_scheduler.rb +++ b/app/workers/scheduler/instance_refresh_scheduler.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Scheduler::InstanceRefreshScheduler - include Sidekiq::Worker - +class Scheduler::InstanceRefreshScheduler < ApplicationWorker sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.day.to_i def perform diff --git a/app/workers/scheduler/ip_cleanup_scheduler.rb b/app/workers/scheduler/ip_cleanup_scheduler.rb index 04fb0aaa330..6bc17a6dbb2 100644 --- a/app/workers/scheduler/ip_cleanup_scheduler.rb +++ b/app/workers/scheduler/ip_cleanup_scheduler.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Scheduler::IpCleanupScheduler - include Sidekiq::Worker - +class Scheduler::IpCleanupScheduler < ApplicationWorker IP_RETENTION_PERIOD = ENV.fetch('IP_RETENTION_PERIOD', 1.year).to_i.seconds.freeze SESSION_RETENTION_PERIOD = ENV.fetch('SESSION_RETENTION_PERIOD', 1.year).to_i.seconds.freeze diff --git a/app/workers/scheduler/pghero_scheduler.rb b/app/workers/scheduler/pghero_scheduler.rb index 49bf2db7a6c..3483e9b3143 100644 --- a/app/workers/scheduler/pghero_scheduler.rb +++ b/app/workers/scheduler/pghero_scheduler.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Scheduler::PgheroScheduler - include Sidekiq::Worker - +class Scheduler::PgheroScheduler < ApplicationWorker sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.day.to_i def perform diff --git a/app/workers/scheduler/scheduled_statuses_scheduler.rb b/app/workers/scheduler/scheduled_statuses_scheduler.rb index 4e251780de5..e090d89ed69 100644 --- a/app/workers/scheduler/scheduled_statuses_scheduler.rb +++ b/app/workers/scheduler/scheduled_statuses_scheduler.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Scheduler::ScheduledStatusesScheduler - include Sidekiq::Worker - +class Scheduler::ScheduledStatusesScheduler < ApplicationWorker sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.hour.to_i def perform diff --git a/app/workers/scheduler/self_destruct_scheduler.rb b/app/workers/scheduler/self_destruct_scheduler.rb index d0b6ce8a076..b985b7a3ba5 100644 --- a/app/workers/scheduler/self_destruct_scheduler.rb +++ b/app/workers/scheduler/self_destruct_scheduler.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class Scheduler::SelfDestructScheduler - include Sidekiq::Worker +class Scheduler::SelfDestructScheduler < ApplicationWorker include SelfDestructHelper MAX_ENQUEUED = 10_000 diff --git a/app/workers/scheduler/software_update_check_scheduler.rb b/app/workers/scheduler/software_update_check_scheduler.rb index c732bdedc01..250d4201a38 100644 --- a/app/workers/scheduler/software_update_check_scheduler.rb +++ b/app/workers/scheduler/software_update_check_scheduler.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Scheduler::SoftwareUpdateCheckScheduler - include Sidekiq::Worker - +class Scheduler::SoftwareUpdateCheckScheduler < ApplicationWorker sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.hour.to_i def perform diff --git a/app/workers/scheduler/suspended_user_cleanup_scheduler.rb b/app/workers/scheduler/suspended_user_cleanup_scheduler.rb index 4ea81c785b3..0db89e48bc6 100644 --- a/app/workers/scheduler/suspended_user_cleanup_scheduler.rb +++ b/app/workers/scheduler/suspended_user_cleanup_scheduler.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Scheduler::SuspendedUserCleanupScheduler - include Sidekiq::Worker - +class Scheduler::SuspendedUserCleanupScheduler < ApplicationWorker # Each processed deletion request may enqueue an enormous # amount of jobs in the `pull` queue, so only enqueue when # the queue is empty or close to being so. diff --git a/app/workers/scheduler/trends/refresh_scheduler.rb b/app/workers/scheduler/trends/refresh_scheduler.rb index 85c000deea7..01790d697a2 100644 --- a/app/workers/scheduler/trends/refresh_scheduler.rb +++ b/app/workers/scheduler/trends/refresh_scheduler.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Scheduler::Trends::RefreshScheduler - include Sidekiq::Worker - +class Scheduler::Trends::RefreshScheduler < ApplicationWorker sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 30.minutes.to_i def perform diff --git a/app/workers/scheduler/trends/review_notifications_scheduler.rb b/app/workers/scheduler/trends/review_notifications_scheduler.rb index f334261bd77..5c9f423eb71 100644 --- a/app/workers/scheduler/trends/review_notifications_scheduler.rb +++ b/app/workers/scheduler/trends/review_notifications_scheduler.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Scheduler::Trends::ReviewNotificationsScheduler - include Sidekiq::Worker - +class Scheduler::Trends::ReviewNotificationsScheduler < ApplicationWorker sidekiq_options retry: 0 def perform diff --git a/app/workers/scheduler/user_cleanup_scheduler.rb b/app/workers/scheduler/user_cleanup_scheduler.rb index 74abc237018..f2bd0b97018 100644 --- a/app/workers/scheduler/user_cleanup_scheduler.rb +++ b/app/workers/scheduler/user_cleanup_scheduler.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Scheduler::UserCleanupScheduler +class Scheduler::UserCleanupScheduler < ApplicationWorker include Sidekiq::Worker UNCONFIRMED_ACCOUNTS_MAX_AGE_DAYS = 7 diff --git a/app/workers/scheduler/vacuum_scheduler.rb b/app/workers/scheduler/vacuum_scheduler.rb index c22d6f5f80f..afc1dbbe4c5 100644 --- a/app/workers/scheduler/vacuum_scheduler.rb +++ b/app/workers/scheduler/vacuum_scheduler.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Scheduler::VacuumScheduler - include Sidekiq::Worker - +class Scheduler::VacuumScheduler < ApplicationWorker sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.day.to_i def perform diff --git a/app/workers/tag_unmerge_worker.rb b/app/workers/tag_unmerge_worker.rb index 1c2a6d1e76b..809aed11563 100644 --- a/app/workers/tag_unmerge_worker.rb +++ b/app/workers/tag_unmerge_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class TagUnmergeWorker - include Sidekiq::Worker +class TagUnmergeWorker < ApplicationWorker include DatabaseHelper sidekiq_options queue: 'pull' diff --git a/app/workers/thread_resolve_worker.rb b/app/workers/thread_resolve_worker.rb index d4cefb3fdc0..79b12e453bb 100644 --- a/app/workers/thread_resolve_worker.rb +++ b/app/workers/thread_resolve_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class ThreadResolveWorker - include Sidekiq::Worker +class ThreadResolveWorker < ApplicationWorker include ExponentialBackoff sidekiq_options queue: 'pull', retry: 3 diff --git a/app/workers/trigger_webhook_worker.rb b/app/workers/trigger_webhook_worker.rb index 2ffb6246f16..262e60a67ff 100644 --- a/app/workers/trigger_webhook_worker.rb +++ b/app/workers/trigger_webhook_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class TriggerWebhookWorker - include Sidekiq::Worker - +class TriggerWebhookWorker < ApplicationWorker def perform(event, class_name, id) object = class_name.constantize.find(id) WebhookService.new.call(event, object) diff --git a/app/workers/unfavourite_worker.rb b/app/workers/unfavourite_worker.rb index cce07e486c7..62fdad3c0f1 100644 --- a/app/workers/unfavourite_worker.rb +++ b/app/workers/unfavourite_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class UnfavouriteWorker - include Sidekiq::Worker - +class UnfavouriteWorker < ApplicationWorker def perform(account_id, status_id) UnfavouriteService.new.call(Account.find(account_id), Status.find(status_id)) rescue ActiveRecord::RecordNotFound diff --git a/app/workers/unfilter_notifications_worker.rb b/app/workers/unfilter_notifications_worker.rb index 223654aa165..3f05e2d84e7 100644 --- a/app/workers/unfilter_notifications_worker.rb +++ b/app/workers/unfilter_notifications_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class UnfilterNotificationsWorker - include Sidekiq::Worker - +class UnfilterNotificationsWorker < ApplicationWorker def perform(notification_request_id) @notification_request = NotificationRequest.find(notification_request_id) diff --git a/app/workers/unfollow_follow_worker.rb b/app/workers/unfollow_follow_worker.rb index a4d57839de9..b82b7c6c90d 100644 --- a/app/workers/unfollow_follow_worker.rb +++ b/app/workers/unfollow_follow_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class UnfollowFollowWorker - include Sidekiq::Worker - +class UnfollowFollowWorker < ApplicationWorker sidekiq_options queue: 'pull' def perform(follower_account_id, old_target_account_id, new_target_account_id, bypass_locked = false) diff --git a/app/workers/unmerge_worker.rb b/app/workers/unmerge_worker.rb index e8ac535dfe6..a7d1d34a098 100644 --- a/app/workers/unmerge_worker.rb +++ b/app/workers/unmerge_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class UnmergeWorker - include Sidekiq::Worker +class UnmergeWorker < ApplicationWorker include DatabaseHelper sidekiq_options queue: 'pull' diff --git a/app/workers/unpublish_announcement_worker.rb b/app/workers/unpublish_announcement_worker.rb index e58c07554a7..288ce446b43 100644 --- a/app/workers/unpublish_announcement_worker.rb +++ b/app/workers/unpublish_announcement_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class UnpublishAnnouncementWorker - include Sidekiq::Worker +class UnpublishAnnouncementWorker < ApplicationWorker include Redisable def perform(announcement_id) diff --git a/app/workers/verify_account_links_worker.rb b/app/workers/verify_account_links_worker.rb index ad27f450b78..985c6433fdc 100644 --- a/app/workers/verify_account_links_worker.rb +++ b/app/workers/verify_account_links_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class VerifyAccountLinksWorker - include Sidekiq::Worker - +class VerifyAccountLinksWorker < ApplicationWorker sidekiq_options queue: 'default', retry: false, lock: :until_executed, lock_ttl: 1.hour.to_i def perform(account_id) diff --git a/app/workers/web/push_notification_worker.rb b/app/workers/web/push_notification_worker.rb index 7e9691aaba3..f1d1d1d81d3 100644 --- a/app/workers/web/push_notification_worker.rb +++ b/app/workers/web/push_notification_worker.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -class Web::PushNotificationWorker - include Sidekiq::Worker - +class Web::PushNotificationWorker < ApplicationWorker sidekiq_options queue: 'push', retry: 5 TTL = 48.hours.to_s diff --git a/app/workers/webhooks/delivery_worker.rb b/app/workers/webhooks/delivery_worker.rb index 3bbc8e22553..254b4867269 100644 --- a/app/workers/webhooks/delivery_worker.rb +++ b/app/workers/webhooks/delivery_worker.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -class Webhooks::DeliveryWorker - include Sidekiq::Worker +class Webhooks::DeliveryWorker < ApplicationWorker include JsonLdHelper sidekiq_options queue: 'push', retry: 16, dead: false