Skip to content

Commit

Permalink
Spread out crawling randomly to avoid DDoSing the link (#8445)
Browse files Browse the repository at this point in the history
* Spread out crawling randomly to avoid DDoSing the link

Fix #4486

* Remove trailing whitespace
  • Loading branch information
Gargron committed Aug 25, 2018
1 parent df06f53 commit b4ba4b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/lib/activitypub/activity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ def notify_about_mentions(status)

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)
Expand Down

0 comments on commit b4ba4b1

Please sign in to comment.