Spread out crawling randomly to avoid DDoSing the link (#8445)

* Spread out crawling randomly to avoid DDoSing the link

Fix #4486

* Remove trailing whitespace
lolsob-rspec
Eugen Rochko 2018-08-26 00:33:57 +02:00 committed by GitHub
parent a75f71380a
commit 3f59f13506
1 changed files with 3 additions and 1 deletions

View File

@ -104,7 +104,9 @@ class ActivityPub::Activity
def crawl_links(status) def crawl_links(status)
return if status.spoiler_text? 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 end
def distribute_to_followers(status) def distribute_to_followers(status)