1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Compare commits

...

2 commits

Author SHA1 Message Date
Matt Jankowski
662c885e7d
Merge 4f8bf2b0cd into 549ab089ee 2024-07-31 11:04:47 +00:00
Matt Jankowski
4f8bf2b0cd Add ApplicationWorker base class for workers 2024-07-18 13:41:56 -04:00
86 changed files with 94 additions and 223 deletions

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AccountDeletionWorker class AccountDeletionWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i
def perform(account_id, options = {}) def perform(account_id, options = {})

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AccountMergingWorker class AccountMergingWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull' sidekiq_options queue: 'pull'
def perform(account_id) def perform(account_id)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AccountRefreshWorker class AccountRefreshWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull', retry: 3, dead: false, lock: :until_executed, lock_ttl: 1.day.to_i sidekiq_options queue: 'pull', retry: 3, dead: false, lock: :until_executed, lock_ttl: 1.day.to_i
def perform(account_id) def perform(account_id)

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class ActivityPub::DeliveryWorker class ActivityPub::DeliveryWorker < ApplicationWorker
include Sidekiq::Worker
include RoutingHelper include RoutingHelper
include JsonLdHelper include JsonLdHelper

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class ActivityPub::DistributePollUpdateWorker class ActivityPub::DistributePollUpdateWorker < ApplicationWorker
include Sidekiq::Worker
include Payloadable include Payloadable
sidekiq_options queue: 'push', lock: :until_executed, retry: 0 sidekiq_options queue: 'push', lock: :until_executed, retry: 0

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class ActivityPub::FetchRepliesWorker class ActivityPub::FetchRepliesWorker < ApplicationWorker
include Sidekiq::Worker
include ExponentialBackoff include ExponentialBackoff
sidekiq_options queue: 'pull', retry: 3 sidekiq_options queue: 'pull', retry: 3

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class ActivityPub::FollowersSynchronizationWorker class ActivityPub::FollowersSynchronizationWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'push', lock: :until_executed sidekiq_options queue: 'push', lock: :until_executed
def perform(account_id, url) def perform(account_id, url)

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class ActivityPub::MoveDistributionWorker class ActivityPub::MoveDistributionWorker < ApplicationWorker
include Sidekiq::Worker
include Payloadable include Payloadable
sidekiq_options queue: 'push' sidekiq_options queue: 'push'

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class ActivityPub::PostUpgradeWorker class ActivityPub::PostUpgradeWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull' sidekiq_options queue: 'pull'
def perform(domain) def perform(domain)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class ActivityPub::ProcessingWorker class ActivityPub::ProcessingWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'ingress', backtrace: true, retry: 8 sidekiq_options queue: 'ingress', backtrace: true, retry: 8
def perform(actor_id, body, delivered_to_account_id = nil, actor_type = 'Account') def perform(actor_id, body, delivered_to_account_id = nil, actor_type = 'Account')

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class ActivityPub::RawDistributionWorker class ActivityPub::RawDistributionWorker < ApplicationWorker
include Sidekiq::Worker
include Payloadable include Payloadable
sidekiq_options queue: 'push' sidekiq_options queue: 'push'

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class ActivityPub::SynchronizeFeaturedCollectionWorker class ActivityPub::SynchronizeFeaturedCollectionWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.day.to_i sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.day.to_i
def perform(account_id, options = {}) def perform(account_id, options = {})

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class ActivityPub::SynchronizeFeaturedTagsCollectionWorker class ActivityPub::SynchronizeFeaturedTagsCollectionWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.day.to_i sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.day.to_i
def perform(account_id, url) def perform(account_id, url)

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddToPublicStatusesIndexWorker class AddToPublicStatusesIndexWorker < ApplicationWorker
include Sidekiq::Worker
include DatabaseHelper include DatabaseHelper
sidekiq_options queue: 'pull' sidekiq_options queue: 'pull'

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Admin::AccountDeletionWorker class Admin::AccountDeletionWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i
def perform(account_id) def perform(account_id)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Admin::DomainPurgeWorker class Admin::DomainPurgeWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i
def perform(domain) def perform(domain)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Admin::SuspensionWorker class Admin::SuspensionWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull' sidekiq_options queue: 'pull'
def perform(account_id) def perform(account_id)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Admin::UnsuspensionWorker class Admin::UnsuspensionWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull' sidekiq_options queue: 'pull'
def perform(account_id) def perform(account_id)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AfterAccountDomainBlockWorker class AfterAccountDomainBlockWorker < ApplicationWorker
include Sidekiq::Worker
def perform(account_id, domain) def perform(account_id, domain)
AfterBlockDomainFromAccountService.new.call(Account.find(account_id), domain) AfterBlockDomainFromAccountService.new.call(Account.find(account_id), domain)
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AfterUnallowDomainWorker class AfterUnallowDomainWorker < ApplicationWorker
include Sidekiq::Worker
def perform(domain) def perform(domain)
AfterUnallowDomainService.new.call(domain) AfterUnallowDomainService.new.call(domain)
end end

View file

@ -0,0 +1,9 @@
# frozen_string_literal: true
class ApplicationWorker
include Sidekiq::Worker
def perform(*)
raise NotImplementedError
end
end

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AuthorizeFollowWorker class AuthorizeFollowWorker < ApplicationWorker
include Sidekiq::Worker
def perform(source_account_id, target_account_id) def perform(source_account_id, target_account_id)
source_account = Account.find(source_account_id) source_account = Account.find(source_account_id)
target_account = Account.find(target_account_id) target_account = Account.find(target_account_id)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class BackupWorker class BackupWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull', backtrace: true, retry: 5, dead: false sidekiq_options queue: 'pull', backtrace: true, retry: 5, dead: false
sidekiq_retries_exhausted do |msg| sidekiq_retries_exhausted do |msg|

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class BlockWorker class BlockWorker < ApplicationWorker
include Sidekiq::Worker
def perform(account_id, target_account_id) def perform(account_id, target_account_id)
AfterBlockService.new.call( AfterBlockService.new.call(
Account.find(account_id), Account.find(account_id),

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class BootstrapTimelineWorker class BootstrapTimelineWorker < ApplicationWorker
include Sidekiq::Worker
def perform(account_id) def perform(account_id)
BootstrapTimelineService.new.call(Account.find(account_id)) BootstrapTimelineService.new.call(Account.find(account_id))
end end

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class BulkImportWorker class BulkImportWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull', retry: false sidekiq_options queue: 'pull', retry: false
def perform(import_id) def perform(import_id)

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class CacheBusterWorker class CacheBusterWorker < ApplicationWorker
include Sidekiq::Worker
include RoutingHelper include RoutingHelper
sidekiq_options queue: 'pull' sidekiq_options queue: 'pull'

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class DeleteMuteWorker class DeleteMuteWorker < ApplicationWorker
include Sidekiq::Worker
def perform(mute_id) def perform(mute_id)
mute = Mute.find_by(id: mute_id) mute = Mute.find_by(id: mute_id)
UnmuteService.new.call(mute.account, mute.target_account) if mute&.expired? UnmuteService.new.call(mute.account, mute.target_account) if mute&.expired?

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class DistributionWorker class DistributionWorker < ApplicationWorker
include Sidekiq::Worker
include Redisable include Redisable
include Lockable include Lockable

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class DomainBlockWorker class DomainBlockWorker < ApplicationWorker
include Sidekiq::Worker
def perform(domain_block_id, update = false) def perform(domain_block_id, update = false)
domain_block = DomainBlock.find_by(id: domain_block_id) domain_block = DomainBlock.find_by(id: domain_block_id)
return true if domain_block.nil? return true if domain_block.nil?

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class DomainClearMediaWorker class DomainClearMediaWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull' sidekiq_options queue: 'pull'
def perform(domain_block_id) def perform(domain_block_id)

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class FeedInsertWorker class FeedInsertWorker < ApplicationWorker
include Sidekiq::Worker
include DatabaseHelper include DatabaseHelper
def perform(status_id, id, type = 'home', options = {}) def perform(status_id, id, type = 'home', options = {})

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class FetchReplyWorker class FetchReplyWorker < ApplicationWorker
include Sidekiq::Worker
include ExponentialBackoff include ExponentialBackoff
sidekiq_options queue: 'pull', retry: 3 sidekiq_options queue: 'pull', retry: 3

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class GenerateAnnualReportWorker class GenerateAnnualReportWorker < ApplicationWorker
include Sidekiq::Worker
def perform(account_id, year) def perform(account_id, year)
AnnualReport.new(Account.find(account_id), year).generate AnnualReport.new(Account.find(account_id), year).generate
rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordNotUnique rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordNotUnique

View file

@ -3,9 +3,7 @@
# NOTE: This is a deprecated worker, only kept to not break ongoing imports # NOTE: This is a deprecated worker, only kept to not break ongoing imports
# on upgrade. See `Import::RowWorker` for its replacement. # on upgrade. See `Import::RowWorker` for its replacement.
class Import::RelationshipWorker class Import::RelationshipWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull', retry: 8, dead: false sidekiq_options queue: 'pull', retry: 8, dead: false
def perform(account_id, target_account_uri, relationship, options) def perform(account_id, target_account_uri, relationship, options)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Import::RowWorker class Import::RowWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull', retry: 6, dead: false sidekiq_options queue: 'pull', retry: 6, dead: false
sidekiq_retries_exhausted do |msg, _exception| sidekiq_retries_exhausted do |msg, _exception|

View file

@ -3,9 +3,7 @@
# NOTE: This is a deprecated worker, only kept to not break ongoing imports # NOTE: This is a deprecated worker, only kept to not break ongoing imports
# on upgrade. See `ImportWorker` for its replacement. # on upgrade. See `ImportWorker` for its replacement.
class ImportWorker class ImportWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull', retry: false sidekiq_options queue: 'pull', retry: false
def perform(import_id) def perform(import_id)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class LinkCrawlWorker class LinkCrawlWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull', retry: 0 sidekiq_options queue: 'pull', retry: 0
def perform(status_id) def perform(status_id)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class LocalNotificationWorker class LocalNotificationWorker < ApplicationWorker
include Sidekiq::Worker
def perform(receiver_account_id, activity_id = nil, activity_class_name = nil, type = nil) def perform(receiver_account_id, activity_id = nil, activity_class_name = nil, type = nil)
if activity_id.nil? && activity_class_name.nil? if activity_id.nil? && activity_class_name.nil?
activity = Mention.find(receiver_account_id) activity = Mention.find(receiver_account_id)

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class MergeWorker class MergeWorker < ApplicationWorker
include Sidekiq::Worker
include Redisable include Redisable
include DatabaseHelper include DatabaseHelper

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class MoveWorker class MoveWorker < ApplicationWorker
include Sidekiq::Worker
def perform(source_account_id, target_account_id) def perform(source_account_id, target_account_id)
@source_account = Account.find(source_account_id) @source_account = Account.find(source_account_id)
@target_account = Account.find(target_account_id) @target_account = Account.find(target_account_id)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class MuteWorker class MuteWorker < ApplicationWorker
include Sidekiq::Worker
def perform(account_id, target_account_id) def perform(account_id, target_account_id)
FeedManager.instance.clear_from_home(Account.find(account_id), Account.find(target_account_id)) FeedManager.instance.clear_from_home(Account.find(account_id), Account.find(target_account_id))
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class PollExpirationNotifyWorker class PollExpirationNotifyWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options lock: :until_executing sidekiq_options lock: :until_executing
def perform(poll_id) def perform(poll_id)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class PostProcessMediaWorker class PostProcessMediaWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options retry: 1, dead: false sidekiq_options retry: 1, dead: false
sidekiq_retries_exhausted do |msg| sidekiq_retries_exhausted do |msg|

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class PublishAnnouncementReactionWorker class PublishAnnouncementReactionWorker < ApplicationWorker
include Sidekiq::Worker
include Redisable include Redisable
def perform(announcement_id, name) def perform(announcement_id, name)

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class PublishScheduledAnnouncementWorker class PublishScheduledAnnouncementWorker < ApplicationWorker
include Sidekiq::Worker
include Redisable include Redisable
def perform(announcement_id) def perform(announcement_id)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class PublishScheduledStatusWorker class PublishScheduledStatusWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options lock: :until_executed, lock_ttl: 1.hour.to_i sidekiq_options lock: :until_executed, lock_ttl: 1.hour.to_i
def perform(scheduled_status_id) def perform(scheduled_status_id)

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class PushConversationWorker class PushConversationWorker < ApplicationWorker
include Sidekiq::Worker
include Redisable include Redisable
def perform(conversation_account_id) def perform(conversation_account_id)

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class PushEncryptedMessageWorker class PushEncryptedMessageWorker < ApplicationWorker
include Sidekiq::Worker
include Redisable include Redisable
def perform(encrypted_message_id) def perform(encrypted_message_id)

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class PushUpdateWorker class PushUpdateWorker < ApplicationWorker
include Sidekiq::Worker
include Redisable include Redisable
def perform(account_id, status_id, timeline_id = nil, options = {}) def perform(account_id, status_id, timeline_id = nil, options = {})

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class RedownloadAvatarWorker class RedownloadAvatarWorker < ApplicationWorker
include Sidekiq::Worker
include ExponentialBackoff include ExponentialBackoff
include JsonLdHelper include JsonLdHelper

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class RedownloadHeaderWorker class RedownloadHeaderWorker < ApplicationWorker
include Sidekiq::Worker
include ExponentialBackoff include ExponentialBackoff
include JsonLdHelper include JsonLdHelper

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class RedownloadMediaWorker class RedownloadMediaWorker < ApplicationWorker
include Sidekiq::Worker
include ExponentialBackoff include ExponentialBackoff
include JsonLdHelper include JsonLdHelper

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class RefollowWorker class RefollowWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull', retry: false sidekiq_options queue: 'pull', retry: false
def perform(target_account_id) def perform(target_account_id)

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class RegenerationWorker class RegenerationWorker < ApplicationWorker
include Sidekiq::Worker
include DatabaseHelper include DatabaseHelper
sidekiq_options lock: :until_executed sidekiq_options lock: :until_executed

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class RemoteAccountRefreshWorker class RemoteAccountRefreshWorker < ApplicationWorker
include Sidekiq::Worker
include ExponentialBackoff include ExponentialBackoff
include JsonLdHelper include JsonLdHelper

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class RemovalWorker class RemovalWorker < ApplicationWorker
include Sidekiq::Worker
def perform(status_id, options = {}) def perform(status_id, options = {})
RemoveStatusService.new.call(Status.with_discarded.find(status_id), **options.symbolize_keys) RemoveStatusService.new.call(Status.with_discarded.find(status_id), **options.symbolize_keys)
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class RemoveFeaturedTagWorker class RemoveFeaturedTagWorker < ApplicationWorker
include Sidekiq::Worker
def perform(account_id, featured_tag_id) def perform(account_id, featured_tag_id)
RemoveFeaturedTagService.new.call(Account.find(account_id), FeaturedTag.find(featured_tag_id)) RemoveFeaturedTagService.new.call(Account.find(account_id), FeaturedTag.find(featured_tag_id))
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class RemoveFromPublicStatusesIndexWorker class RemoveFromPublicStatusesIndexWorker < ApplicationWorker
include Sidekiq::Worker
def perform(account_id) def perform(account_id)
account = Account.find(account_id) account = Account.find(account_id)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class ResolveAccountWorker class ResolveAccountWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.day.to_i sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.day.to_i
def perform(uri) def perform(uri)

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Scheduler::AccountsStatusesCleanupScheduler class Scheduler::AccountsStatusesCleanupScheduler < ApplicationWorker
include Sidekiq::Worker
include Redisable include Redisable
# This limit is mostly to be nice to the fediverse at large and not # This limit is mostly to be nice to the fediverse at large and not

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Scheduler::AutoCloseRegistrationsScheduler class Scheduler::AutoCloseRegistrationsScheduler < ApplicationWorker
include Sidekiq::Worker
include Redisable include Redisable
sidekiq_options retry: 0 sidekiq_options retry: 0

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Scheduler::FollowRecommendationsScheduler class Scheduler::FollowRecommendationsScheduler < ApplicationWorker
include Sidekiq::Worker
sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.day.to_i sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.day.to_i
def perform def perform

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Scheduler::IndexingScheduler class Scheduler::IndexingScheduler < ApplicationWorker
include Sidekiq::Worker
include Redisable include Redisable
include DatabaseHelper include DatabaseHelper

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Scheduler::InstanceRefreshScheduler class Scheduler::InstanceRefreshScheduler < ApplicationWorker
include Sidekiq::Worker
sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.day.to_i sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.day.to_i
def perform def perform

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Scheduler::IpCleanupScheduler class Scheduler::IpCleanupScheduler < ApplicationWorker
include Sidekiq::Worker
IP_RETENTION_PERIOD = ENV.fetch('IP_RETENTION_PERIOD', 1.year).to_i.seconds.freeze 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 SESSION_RETENTION_PERIOD = ENV.fetch('SESSION_RETENTION_PERIOD', 1.year).to_i.seconds.freeze

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Scheduler::PgheroScheduler class Scheduler::PgheroScheduler < ApplicationWorker
include Sidekiq::Worker
sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.day.to_i sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.day.to_i
def perform def perform

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Scheduler::ScheduledStatusesScheduler class Scheduler::ScheduledStatusesScheduler < ApplicationWorker
include Sidekiq::Worker
sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.hour.to_i sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.hour.to_i
def perform def perform

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Scheduler::SelfDestructScheduler class Scheduler::SelfDestructScheduler < ApplicationWorker
include Sidekiq::Worker
include SelfDestructHelper include SelfDestructHelper
MAX_ENQUEUED = 10_000 MAX_ENQUEUED = 10_000

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Scheduler::SoftwareUpdateCheckScheduler class Scheduler::SoftwareUpdateCheckScheduler < ApplicationWorker
include Sidekiq::Worker
sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.hour.to_i sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.hour.to_i
def perform def perform

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Scheduler::SuspendedUserCleanupScheduler class Scheduler::SuspendedUserCleanupScheduler < ApplicationWorker
include Sidekiq::Worker
# Each processed deletion request may enqueue an enormous # Each processed deletion request may enqueue an enormous
# amount of jobs in the `pull` queue, so only enqueue when # amount of jobs in the `pull` queue, so only enqueue when
# the queue is empty or close to being so. # the queue is empty or close to being so.

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Scheduler::Trends::RefreshScheduler class Scheduler::Trends::RefreshScheduler < ApplicationWorker
include Sidekiq::Worker
sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 30.minutes.to_i sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 30.minutes.to_i
def perform def perform

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Scheduler::Trends::ReviewNotificationsScheduler class Scheduler::Trends::ReviewNotificationsScheduler < ApplicationWorker
include Sidekiq::Worker
sidekiq_options retry: 0 sidekiq_options retry: 0
def perform def perform

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Scheduler::UserCleanupScheduler class Scheduler::UserCleanupScheduler < ApplicationWorker
include Sidekiq::Worker include Sidekiq::Worker
UNCONFIRMED_ACCOUNTS_MAX_AGE_DAYS = 7 UNCONFIRMED_ACCOUNTS_MAX_AGE_DAYS = 7

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Scheduler::VacuumScheduler class Scheduler::VacuumScheduler < ApplicationWorker
include Sidekiq::Worker
sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.day.to_i sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.day.to_i
def perform def perform

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class TagUnmergeWorker class TagUnmergeWorker < ApplicationWorker
include Sidekiq::Worker
include DatabaseHelper include DatabaseHelper
sidekiq_options queue: 'pull' sidekiq_options queue: 'pull'

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class ThreadResolveWorker class ThreadResolveWorker < ApplicationWorker
include Sidekiq::Worker
include ExponentialBackoff include ExponentialBackoff
sidekiq_options queue: 'pull', retry: 3 sidekiq_options queue: 'pull', retry: 3

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class TriggerWebhookWorker class TriggerWebhookWorker < ApplicationWorker
include Sidekiq::Worker
def perform(event, class_name, id) def perform(event, class_name, id)
object = class_name.constantize.find(id) object = class_name.constantize.find(id)
WebhookService.new.call(event, object) WebhookService.new.call(event, object)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class UnfavouriteWorker class UnfavouriteWorker < ApplicationWorker
include Sidekiq::Worker
def perform(account_id, status_id) def perform(account_id, status_id)
UnfavouriteService.new.call(Account.find(account_id), Status.find(status_id)) UnfavouriteService.new.call(Account.find(account_id), Status.find(status_id))
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class UnfilterNotificationsWorker class UnfilterNotificationsWorker < ApplicationWorker
include Sidekiq::Worker
def perform(notification_request_id) def perform(notification_request_id)
@notification_request = NotificationRequest.find(notification_request_id) @notification_request = NotificationRequest.find(notification_request_id)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class UnfollowFollowWorker class UnfollowFollowWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull' sidekiq_options queue: 'pull'
def perform(follower_account_id, old_target_account_id, new_target_account_id, bypass_locked = false) def perform(follower_account_id, old_target_account_id, new_target_account_id, bypass_locked = false)

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class UnmergeWorker class UnmergeWorker < ApplicationWorker
include Sidekiq::Worker
include DatabaseHelper include DatabaseHelper
sidekiq_options queue: 'pull' sidekiq_options queue: 'pull'

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class UnpublishAnnouncementWorker class UnpublishAnnouncementWorker < ApplicationWorker
include Sidekiq::Worker
include Redisable include Redisable
def perform(announcement_id) def perform(announcement_id)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class VerifyAccountLinksWorker class VerifyAccountLinksWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'default', retry: false, lock: :until_executed, lock_ttl: 1.hour.to_i sidekiq_options queue: 'default', retry: false, lock: :until_executed, lock_ttl: 1.hour.to_i
def perform(account_id) def perform(account_id)

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Web::PushNotificationWorker class Web::PushNotificationWorker < ApplicationWorker
include Sidekiq::Worker
sidekiq_options queue: 'push', retry: 5 sidekiq_options queue: 'push', retry: 5
TTL = 48.hours.to_s TTL = 48.hours.to_s

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Webhooks::DeliveryWorker class Webhooks::DeliveryWorker < ApplicationWorker
include Sidekiq::Worker
include JsonLdHelper include JsonLdHelper
sidekiq_options queue: 'push', retry: 16, dead: false sidekiq_options queue: 'push', retry: 16, dead: false