Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `README.md`: Upstream README has been changed, but we have a completely different one. Kept our `README.md`. - `lib/sanitize_ext/sanitize_config.rb`: Upstream added support for more incoming HTML tags (a large subset of what glitch-soc accepts). Change the code style to match upstream's but otherwise do not change our code. - `spec/lib/sanitize_config_spec.rb`: Upstream added support for more incoming HTML tags (a large subset of what glitch-soc accepts). Kept our version, since the tests are mostly glitch-soc's, except for cases which are purposefuly different.
This commit is contained in:
@@ -10,6 +10,16 @@ class ActivityPub::DeliveryWorker
|
||||
|
||||
sidekiq_options queue: 'push', retry: 16, dead: false
|
||||
|
||||
# Unfortunately, we cannot control Sidekiq's jitter, so add our own
|
||||
sidekiq_retry_in do |count|
|
||||
# This is Sidekiq's default delay
|
||||
delay = (count**4) + 15
|
||||
# Our custom jitter, that will be added to Sidekiq's built-in one.
|
||||
# Sidekiq's built-in jitter is `rand(10) * (count + 1)`
|
||||
jitter = rand(0.5 * (count**4))
|
||||
delay + jitter
|
||||
end
|
||||
|
||||
HEADERS = { 'Content-Type' => 'application/activity+json' }.freeze
|
||||
|
||||
def perform(json, source_account_id, inbox_url, options = {})
|
||||
|
||||
17
app/workers/activitypub/migrated_follow_delivery_worker.rb
Normal file
17
app/workers/activitypub/migrated_follow_delivery_worker.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::MigratedFollowDeliveryWorker < ActivityPub::DeliveryWorker
|
||||
def perform(json, source_account_id, inbox_url, old_target_account_id, options = {})
|
||||
super(json, source_account_id, inbox_url, options)
|
||||
unfollow_old_account!(old_target_account_id)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def unfollow_old_account!(old_target_account_id)
|
||||
old_target_account = Account.find(old_target_account_id)
|
||||
UnfollowService.new.call(@source_account, old_target_account, skip_unmerge: true)
|
||||
rescue
|
||||
true
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user