From: Eugen Rochko Date: Sat, 25 Aug 2018 22:33:57 +0000 (+0200) Subject: Spread out crawling randomly to avoid DDoSing the link (#8445) X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=b4ba4b1b5da8d3c7a63ee41c2a440767e1e23104;p=mastodon.git Spread out crawling randomly to avoid DDoSing the link (#8445) * Spread out crawling randomly to avoid DDoSing the link Fix #4486 * Remove trailing whitespace --- diff --git a/app/lib/activitypub/activity.rb b/app/lib/activitypub/activity.rb index 03476920b..3a39b723e 100644 --- a/app/lib/activitypub/activity.rb +++ b/app/lib/activitypub/activity.rb @@ -104,7 +104,9 @@ class ActivityPub::Activity def crawl_links(status) return if status.spoiler_text? - LinkCrawlWorker.perform_async(status.id) + + # Spread out crawling randomly to avoid DDoSing the link + LinkCrawlWorker.perform_in(rand(1..59).seconds, status.id) end def distribute_to_followers(status)