From 7944ed6fe51d00e49a044e04e624e72ff7be3bce Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Mon, 21 Nov 2016 22:04:10 +0100
Subject: [PATCH] Adding option to specify asset server, filter followers query
 by local accounts during Fan Out On Write to load less stuff into memory

---
 app/services/fan_out_on_write_service.rb | 4 ++--
 config/environments/production.rb        | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb
index 70cf06e02b..78cb0b13f8 100644
--- a/app/services/fan_out_on_write_service.rb
+++ b/app/services/fan_out_on_write_service.rb
@@ -24,8 +24,8 @@ class FanOutOnWriteService < BaseService
   def deliver_to_followers(status)
     Rails.logger.debug "Delivering status #{status.id} to followers"
 
-    status.account.followers.find_each do |follower|
-      next if !follower.local? || FeedManager.instance.filter?(:home, status, follower)
+    status.account.followers.where(domain: nil).find_each do |follower|
+      next if FeedManager.instance.filter?(:home, status, follower)
       FeedManager.instance.push(:home, follower, status)
     end
   end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 27238e3d88..7f13fcf6b3 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -13,6 +13,7 @@ Rails.application.configure do
   # Full error reports are disabled and caching is turned on.
   config.consider_all_requests_local       = false
   config.action_controller.perform_caching = true
+  config.action_controller.asset_host      = ENV['CDN_HOST']
 
   # Disable serving static files from the `/public` folder by default since
   # Apache or NGINX already handles this.
-- 
GitLab