Merge tag 'v3.1.4' into hometown-dev
This commit is contained in:
@ -12,7 +12,7 @@ class ActivityPub::DeliveryWorker
|
||||
HEADERS = { 'Content-Type' => 'application/activity+json' }.freeze
|
||||
|
||||
def perform(json, source_account_id, inbox_url, options = {})
|
||||
return if DeliveryFailureTracker.unavailable?(inbox_url)
|
||||
return unless DeliveryFailureTracker.available?(inbox_url)
|
||||
|
||||
@options = options.with_indifferent_access
|
||||
@json = json
|
||||
@ -23,10 +23,12 @@ class ActivityPub::DeliveryWorker
|
||||
|
||||
perform_request
|
||||
ensure
|
||||
if @performed
|
||||
failure_tracker.track_success!
|
||||
else
|
||||
failure_tracker.track_failure!
|
||||
if @inbox_url.present?
|
||||
if @performed
|
||||
failure_tracker.track_success!
|
||||
else
|
||||
failure_tracker.track_failure!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -50,13 +52,9 @@ class ActivityPub::DeliveryWorker
|
||||
end
|
||||
end
|
||||
|
||||
begin
|
||||
light.with_threshold(STOPLIGHT_FAILURE_THRESHOLD)
|
||||
.with_cool_off_time(STOPLIGHT_COOLDOWN)
|
||||
.run
|
||||
rescue Stoplight::Error::RedLight => e
|
||||
raise e.class, e.message, e.backtrace.first(3)
|
||||
end
|
||||
light.with_threshold(STOPLIGHT_FAILURE_THRESHOLD)
|
||||
.with_cool_off_time(STOPLIGHT_COOLDOWN)
|
||||
.run
|
||||
end
|
||||
|
||||
def failure_tracker
|
||||
|
||||
@ -4,7 +4,7 @@ class ActivityPub::DistributePollUpdateWorker
|
||||
include Sidekiq::Worker
|
||||
include Payloadable
|
||||
|
||||
sidekiq_options queue: 'push', unique: :until_executed, retry: 0
|
||||
sidekiq_options queue: 'push', lock: :until_executed, retry: 0
|
||||
|
||||
def perform(status_id)
|
||||
@status = Status.find(status_id)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
class ActivityPub::SynchronizeFeaturedCollectionWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'pull', unique: :until_executed
|
||||
sidekiq_options queue: 'pull', lock: :until_executed
|
||||
|
||||
def perform(account_id)
|
||||
ActivityPub::FetchFeaturedCollectionService.new.call(Account.find(account_id))
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AfterRemoteFollowRequestWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'pull', retry: 5
|
||||
|
||||
def perform(follow_request_id); end
|
||||
end
|
||||
@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AfterRemoteFollowWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'pull', retry: 5
|
||||
|
||||
def perform(follow_id); end
|
||||
end
|
||||
@ -9,8 +9,12 @@ class BackupWorker
|
||||
backup_id = msg['args'].first
|
||||
|
||||
ActiveRecord::Base.connection_pool.with_connection do
|
||||
backup = Backup.find(backup_id)
|
||||
backup&.destroy
|
||||
begin
|
||||
backup = Backup.find(backup_id)
|
||||
backup.destroy
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class NotificationWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'push', retry: 5
|
||||
|
||||
def perform(xml, source_account_id, target_account_id); end
|
||||
end
|
||||
@ -3,7 +3,7 @@
|
||||
class PollExpirationNotifyWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options unique: :until_executed
|
||||
sidekiq_options lock: :until_executed
|
||||
|
||||
def perform(poll_id)
|
||||
poll = Poll.find(poll_id)
|
||||
|
||||
34
app/workers/post_process_media_worker.rb
Normal file
34
app/workers/post_process_media_worker.rb
Normal file
@ -0,0 +1,34 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PostProcessMediaWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options retry: 1, dead: false
|
||||
|
||||
sidekiq_retries_exhausted do |msg|
|
||||
media_attachment_id = msg['args'].first
|
||||
|
||||
ActiveRecord::Base.connection_pool.with_connection do
|
||||
begin
|
||||
media_attachment = MediaAttachment.find(media_attachment_id)
|
||||
media_attachment.processing = :failed
|
||||
media_attachment.save
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
Sidekiq.logger.error("Processing media attachment #{media_attachment_id} failed with #{msg['error_message']}")
|
||||
end
|
||||
|
||||
def perform(media_attachment_id)
|
||||
media_attachment = MediaAttachment.find(media_attachment_id)
|
||||
media_attachment.processing = :in_progress
|
||||
media_attachment.save
|
||||
media_attachment.file.reprocess!(:original)
|
||||
media_attachment.processing = :complete
|
||||
media_attachment.save
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ProcessingWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options backtrace: true
|
||||
|
||||
def perform(account_id, body); end
|
||||
end
|
||||
@ -5,15 +5,24 @@ class PublishScheduledAnnouncementWorker
|
||||
include Redisable
|
||||
|
||||
def perform(announcement_id)
|
||||
announcement = Announcement.find(announcement_id)
|
||||
@announcement = Announcement.find(announcement_id)
|
||||
|
||||
announcement.publish! unless announcement.published?
|
||||
refresh_status_ids!
|
||||
|
||||
payload = InlineRenderer.render(announcement, nil, :announcement)
|
||||
@announcement.publish! unless @announcement.published?
|
||||
|
||||
payload = InlineRenderer.render(@announcement, nil, :announcement)
|
||||
payload = Oj.dump(event: :announcement, payload: payload)
|
||||
|
||||
FeedManager.instance.with_active_accounts do |account|
|
||||
redis.publish("timeline:#{account.id}", payload) if redis.exists("subscribed:timeline:#{account.id}")
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def refresh_status_ids!
|
||||
@announcement.status_ids = Status.from_text(@announcement.text).map(&:id)
|
||||
@announcement.save
|
||||
end
|
||||
end
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
class PublishScheduledStatusWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options unique: :until_executed
|
||||
sidekiq_options lock: :until_executed
|
||||
|
||||
def perform(scheduled_status_id)
|
||||
scheduled_status = ScheduledStatus.find(scheduled_status_id)
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Pubsubhubbub::ConfirmationWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'push', retry: false
|
||||
|
||||
def perform(subscription_id, mode, secret = nil, lease_seconds = nil); end
|
||||
end
|
||||
@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Pubsubhubbub::DeliveryWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'push', retry: 3, dead: false
|
||||
|
||||
def perform(subscription_id, payload); end
|
||||
end
|
||||
@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Pubsubhubbub::DistributionWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'push'
|
||||
|
||||
def perform(stream_entry_ids); end
|
||||
end
|
||||
@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Pubsubhubbub::RawDistributionWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'push'
|
||||
|
||||
def perform(xml, source_account_id); end
|
||||
end
|
||||
@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Pubsubhubbub::SubscribeWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'push', retry: 10, unique: :until_executed, dead: false
|
||||
|
||||
def perform(account_id); end
|
||||
end
|
||||
@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Pubsubhubbub::UnsubscribeWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'push', retry: false, unique: :until_executed, dead: false
|
||||
|
||||
def perform(account_id); end
|
||||
end
|
||||
@ -11,7 +11,7 @@ class RedownloadMediaWorker
|
||||
|
||||
return if media_attachment.remote_url.blank?
|
||||
|
||||
media_attachment.reset_file!
|
||||
media_attachment.file_remote_url = media_attachment.remote_url
|
||||
media_attachment.save
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
class RegenerationWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options unique: :until_executed
|
||||
sidekiq_options lock: :until_executed
|
||||
|
||||
def perform(account_id, _ = :home)
|
||||
account = Account.find(account_id)
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RemoteProfileUpdateWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'pull'
|
||||
|
||||
def perform(account_id, body, resubscribe); end
|
||||
end
|
||||
@ -3,7 +3,7 @@
|
||||
class ResolveAccountWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'pull', unique: :until_executed
|
||||
sidekiq_options queue: 'pull', lock: :until_executed
|
||||
|
||||
def perform(uri)
|
||||
ResolveAccountService.new.call(uri)
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class SalmonWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options backtrace: true
|
||||
|
||||
def perform(account_id, body); end
|
||||
end
|
||||
@ -3,7 +3,7 @@
|
||||
class Scheduler::BackupCleanupScheduler
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options unique: :until_executed, retry: 0
|
||||
sidekiq_options lock: :until_executed, retry: 0
|
||||
|
||||
def perform
|
||||
old_backups.reorder(nil).find_each(&:destroy!)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
class Scheduler::DoorkeeperCleanupScheduler
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options unique: :until_executed, retry: 0
|
||||
sidekiq_options lock: :until_executed, retry: 0
|
||||
|
||||
def perform
|
||||
Doorkeeper::AccessToken.where('revoked_at IS NOT NULL').where('revoked_at < NOW()').delete_all
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
class Scheduler::EmailScheduler
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options unique: :until_executed, retry: 0
|
||||
sidekiq_options lock: :until_executed, retry: 0
|
||||
|
||||
FREQUENCY = 7.days.freeze
|
||||
SIGN_IN_OFFSET = 1.day.freeze
|
||||
|
||||
@ -4,7 +4,7 @@ class Scheduler::FeedCleanupScheduler
|
||||
include Sidekiq::Worker
|
||||
include Redisable
|
||||
|
||||
sidekiq_options unique: :until_executed, retry: 0
|
||||
sidekiq_options lock: :until_executed, retry: 0
|
||||
|
||||
def perform
|
||||
clean_home_feeds!
|
||||
|
||||
@ -5,7 +5,7 @@ class Scheduler::IpCleanupScheduler
|
||||
|
||||
RETENTION_PERIOD = 1.year
|
||||
|
||||
sidekiq_options unique: :until_executed, retry: 0
|
||||
sidekiq_options lock: :until_executed, retry: 0
|
||||
|
||||
def perform
|
||||
time_ago = RETENTION_PERIOD.ago
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
class Scheduler::MediaCleanupScheduler
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options unique: :until_executed, retry: 0
|
||||
sidekiq_options lock: :until_executed, retry: 0
|
||||
|
||||
def perform
|
||||
unattached_media.find_each(&:destroy)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
class Scheduler::PgheroScheduler
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options unique: :until_executed, retry: 0
|
||||
sidekiq_options lock: :until_executed, retry: 0
|
||||
|
||||
def perform
|
||||
PgHero.capture_space_stats
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
class Scheduler::ScheduledStatusesScheduler
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options unique: :until_executed, retry: 0
|
||||
sidekiq_options lock: :until_executed, retry: 0
|
||||
|
||||
def perform
|
||||
publish_scheduled_statuses!
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Scheduler::SubscriptionsCleanupScheduler
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options unique: :until_executed, retry: 0
|
||||
|
||||
def perform; end
|
||||
end
|
||||
@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Scheduler::SubscriptionsScheduler
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options unique: :until_executed, retry: 0
|
||||
|
||||
def perform; end
|
||||
end
|
||||
@ -3,7 +3,7 @@
|
||||
class Scheduler::TrendingTagsScheduler
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options unique: :until_executed, retry: 0
|
||||
sidekiq_options lock: :until_executed, retry: 0
|
||||
|
||||
def perform
|
||||
TrendingTags.update! if Setting.trends
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
class Scheduler::UserCleanupScheduler
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options unique: :until_executed, retry: 0
|
||||
sidekiq_options lock: :until_executed, retry: 0
|
||||
|
||||
def perform
|
||||
User.where('confirmed_at is NULL AND confirmation_sent_at <= ?', 2.days.ago).reorder(nil).find_in_batches do |batch|
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
class VerifyAccountLinksWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'pull', retry: false, unique: :until_executed
|
||||
sidekiq_options queue: 'pull', retry: false, lock: :until_executed
|
||||
|
||||
def perform(account_id)
|
||||
account = Account.find(account_id)
|
||||
|
||||
Reference in New Issue
Block a user