Browse Source

Change `ActivityPub::DeliveryWorker` retries to be spread out more (#21956)

closed-social-glitch-2
Claire 1 year ago
committed by GitHub
parent
commit
ddde4e0d95
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      app/workers/activitypub/delivery_worker.rb

+ 10
- 0
app/workers/activitypub/delivery_worker.rb View File

@ -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 = {})

Loading…
Cancel
Save