From 8d73fbee87c18300c1b088ae4cb55912075588e2 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 3 Oct 2023 10:09:00 +0200 Subject: [PATCH] Change some worker lock TTLs (#27246) --- app/workers/account_deletion_worker.rb | 2 +- .../activitypub/synchronize_featured_collection_worker.rb | 2 +- .../activitypub/synchronize_featured_tags_collection_worker.rb | 2 +- app/workers/activitypub/update_distribution_worker.rb | 2 +- app/workers/admin/account_deletion_worker.rb | 2 +- app/workers/admin/domain_purge_worker.rb | 2 +- app/workers/publish_scheduled_status_worker.rb | 2 +- app/workers/resolve_account_worker.rb | 2 +- app/workers/scheduler/indexing_scheduler.rb | 2 +- app/workers/scheduler/scheduled_statuses_scheduler.rb | 2 +- app/workers/verify_account_links_worker.rb | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/workers/account_deletion_worker.rb b/app/workers/account_deletion_worker.rb index fdf013e01..7b8a31f8c 100644 --- a/app/workers/account_deletion_worker.rb +++ b/app/workers/account_deletion_worker.rb @@ -3,7 +3,7 @@ class AccountDeletionWorker include Sidekiq::Worker - sidekiq_options queue: 'pull', lock: :until_executed + sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i def perform(account_id, options = {}) reserve_username = options.with_indifferent_access.fetch(:reserve_username, true) diff --git a/app/workers/activitypub/synchronize_featured_collection_worker.rb b/app/workers/activitypub/synchronize_featured_collection_worker.rb index f67d693cb..7a187d7f5 100644 --- a/app/workers/activitypub/synchronize_featured_collection_worker.rb +++ b/app/workers/activitypub/synchronize_featured_collection_worker.rb @@ -3,7 +3,7 @@ class ActivityPub::SynchronizeFeaturedCollectionWorker include Sidekiq::Worker - sidekiq_options queue: 'pull', lock: :until_executed + sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.day.to_i def perform(account_id, options = {}) options = { note: true, hashtag: false }.deep_merge(options.deep_symbolize_keys) diff --git a/app/workers/activitypub/synchronize_featured_tags_collection_worker.rb b/app/workers/activitypub/synchronize_featured_tags_collection_worker.rb index 14af4f725..570415c82 100644 --- a/app/workers/activitypub/synchronize_featured_tags_collection_worker.rb +++ b/app/workers/activitypub/synchronize_featured_tags_collection_worker.rb @@ -3,7 +3,7 @@ class ActivityPub::SynchronizeFeaturedTagsCollectionWorker include Sidekiq::Worker - sidekiq_options queue: 'pull', lock: :until_executed + sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.day.to_i def perform(account_id, url) ActivityPub::FetchFeaturedTagsCollectionService.new.call(Account.find(account_id), url) diff --git a/app/workers/activitypub/update_distribution_worker.rb b/app/workers/activitypub/update_distribution_worker.rb index d0391bb6f..a04ac621f 100644 --- a/app/workers/activitypub/update_distribution_worker.rb +++ b/app/workers/activitypub/update_distribution_worker.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class ActivityPub::UpdateDistributionWorker < ActivityPub::RawDistributionWorker - sidekiq_options queue: 'push', lock: :until_executed + sidekiq_options queue: 'push', lock: :until_executed, lock_ttl: 1.day.to_i # Distribute an profile update to servers that might have a copy # of the account in question diff --git a/app/workers/admin/account_deletion_worker.rb b/app/workers/admin/account_deletion_worker.rb index 6e0eb331b..5dfdfb6e7 100644 --- a/app/workers/admin/account_deletion_worker.rb +++ b/app/workers/admin/account_deletion_worker.rb @@ -3,7 +3,7 @@ class Admin::AccountDeletionWorker include Sidekiq::Worker - sidekiq_options queue: 'pull', lock: :until_executed + sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i def perform(account_id) DeleteAccountService.new.call(Account.find(account_id), reserve_username: true, reserve_email: true) diff --git a/app/workers/admin/domain_purge_worker.rb b/app/workers/admin/domain_purge_worker.rb index 095232a6d..6c5250b66 100644 --- a/app/workers/admin/domain_purge_worker.rb +++ b/app/workers/admin/domain_purge_worker.rb @@ -3,7 +3,7 @@ class Admin::DomainPurgeWorker include Sidekiq::Worker - sidekiq_options queue: 'pull', lock: :until_executed + sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i def perform(domain) PurgeDomainService.new.call(domain) diff --git a/app/workers/publish_scheduled_status_worker.rb b/app/workers/publish_scheduled_status_worker.rb index ce42f7be7..aa5c4a834 100644 --- a/app/workers/publish_scheduled_status_worker.rb +++ b/app/workers/publish_scheduled_status_worker.rb @@ -3,7 +3,7 @@ class PublishScheduledStatusWorker include Sidekiq::Worker - sidekiq_options lock: :until_executed + sidekiq_options lock: :until_executed, lock_ttl: 1.hour.to_i def perform(scheduled_status_id) scheduled_status = ScheduledStatus.find(scheduled_status_id) diff --git a/app/workers/resolve_account_worker.rb b/app/workers/resolve_account_worker.rb index 2b5be6d1b..4ae2442af 100644 --- a/app/workers/resolve_account_worker.rb +++ b/app/workers/resolve_account_worker.rb @@ -3,7 +3,7 @@ class ResolveAccountWorker include Sidekiq::Worker - sidekiq_options queue: 'pull', lock: :until_executed + sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.day.to_i def perform(uri) ResolveAccountService.new.call(uri) diff --git a/app/workers/scheduler/indexing_scheduler.rb b/app/workers/scheduler/indexing_scheduler.rb index d622f5586..cde6210fb 100644 --- a/app/workers/scheduler/indexing_scheduler.rb +++ b/app/workers/scheduler/indexing_scheduler.rb @@ -4,7 +4,7 @@ class Scheduler::IndexingScheduler include Sidekiq::Worker include Redisable - sidekiq_options retry: 0 + sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 30.minutes.to_i IMPORT_BATCH_SIZE = 1000 SCAN_BATCH_SIZE = 10 * IMPORT_BATCH_SIZE diff --git a/app/workers/scheduler/scheduled_statuses_scheduler.rb b/app/workers/scheduler/scheduled_statuses_scheduler.rb index 3bf6300b3..fe60d5524 100644 --- a/app/workers/scheduler/scheduled_statuses_scheduler.rb +++ b/app/workers/scheduler/scheduled_statuses_scheduler.rb @@ -3,7 +3,7 @@ class Scheduler::ScheduledStatusesScheduler include Sidekiq::Worker - sidekiq_options retry: 0 + sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.hour.to_i def perform publish_scheduled_statuses! diff --git a/app/workers/verify_account_links_worker.rb b/app/workers/verify_account_links_worker.rb index f606e6c26..ad27f450b 100644 --- a/app/workers/verify_account_links_worker.rb +++ b/app/workers/verify_account_links_worker.rb @@ -3,7 +3,7 @@ class VerifyAccountLinksWorker include Sidekiq::Worker - sidekiq_options queue: 'default', retry: false, lock: :until_executed + sidekiq_options queue: 'default', retry: false, lock: :until_executed, lock_ttl: 1.hour.to_i def perform(account_id) account = Account.find(account_id)