]> cat aescling's git repositories - mastodon.git/commitdiff
Spread out crawling randomly to avoid DDoSing the link (#8445)
authorEugen Rochko <eugen@zeonfederated.com>
Sat, 25 Aug 2018 22:33:57 +0000 (00:33 +0200)
committerGitHub <noreply@github.com>
Sat, 25 Aug 2018 22:33:57 +0000 (00:33 +0200)
* Spread out crawling randomly to avoid DDoSing the link

Fix #4486

* Remove trailing whitespace

app/lib/activitypub/activity.rb

index 03476920b265adac918cd91254c3506e9192cceb..3a39b723ed13f70b3360bb73e475f52e5330cade 100644 (file)
@@ -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)