about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-04-05 19:45:18 +0200
committerEugen Rochko <eugen@zeonfederated.com>2017-04-05 19:45:18 +0200
commit5b95be1c42ba69c9a3a79cfa990c80a5f2debfc6 (patch)
tree297367867dfee6a584bcd16d631a2f8714ddfd80 /app/services
parentd755ce96da00cee1c8e51204cf5ede79764f4fb9 (diff)
Replace calls to FeedManager#inline_render and #broadcast
Diffstat (limited to 'app/services')
-rw-r--r--app/services/fan_out_on_write_service.rb10
-rw-r--r--app/services/notify_service.rb2
-rw-r--r--app/services/remove_status_service.rb6
3 files changed, 9 insertions, 9 deletions
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb
index 106d257ba..c63fcc1fe 100644
--- a/app/services/fan_out_on_write_service.rb
+++ b/app/services/fan_out_on_write_service.rb
@@ -50,22 +50,22 @@ class FanOutOnWriteService < BaseService
   end
 
   def render_anonymous_payload(status)
-    @payload = FeedManager.instance.inline_render(nil, 'api/v1/statuses/show', status)
+    @payload = InlineRenderer.render(status, nil, 'api/v1/statuses/show')
   end
 
   def deliver_to_hashtags(status)
     Rails.logger.debug "Delivering status #{status.id} to hashtags"
 
     status.tags.pluck(:name).each do |hashtag|
-      FeedManager.instance.broadcast("hashtag:#{hashtag}", event: 'update', payload: @payload)
-      FeedManager.instance.broadcast("hashtag:#{hashtag}:local", event: 'update', payload: @payload) if status.account.local?
+      Redis.current.publish("hashtag:#{hashtag}", Oj.dump(event: :update, payload: @payload))
+      Redis.current.publish("hashtag:#{hashtag}:local", Oj.dump(event: :update, payload: @payload)) if status.account.local?
     end
   end
 
   def deliver_to_public(status)
     Rails.logger.debug "Delivering status #{status.id} to public timeline"
 
-    FeedManager.instance.broadcast(:public, event: 'update', payload: @payload)
-    FeedManager.instance.broadcast('public:local', event: 'update', payload: @payload) if status.account.local?
+    Redis.current.publish('public', Oj.dump(event: 'update', payload: @payload))
+    Redis.current.publish('public:local', Oj.dump(event: 'update', payload: @payload)) if status.account.local?
   end
 end
diff --git a/app/services/notify_service.rb b/app/services/notify_service.rb
index 24486f220..62508a049 100644
--- a/app/services/notify_service.rb
+++ b/app/services/notify_service.rb
@@ -50,7 +50,7 @@ class NotifyService < BaseService
   def create_notification
     @notification.save!
     return unless @notification.browserable?
-    FeedManager.instance.broadcast(@recipient.id, event: 'notification', payload: FeedManager.instance.inline_render(@recipient, 'api/v1/notifications/show', @notification))
+    Redis.current.publish(@recipient.id, Oj.dump(event: :notification, payload: InlineRenderer.render(@notification, @recipient, 'api/v1/notifications/show')))
   end
 
   def send_email
diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb
index cf1f432e4..e19fdd030 100644
--- a/app/services/remove_status_service.rb
+++ b/app/services/remove_status_service.rb
@@ -65,17 +65,17 @@ class RemoveStatusService < BaseService
       redis.zremrangebyscore(FeedManager.instance.key(type, receiver.id), status.id, status.id)
     end
 
-    FeedManager.instance.broadcast(receiver.id, event: 'delete', payload: status.id)
+    Redis.current.publish(receiver.id, Oj.dump(event: :delete, payload: status.id))
   end
 
   def remove_from_hashtags(status)
     status.tags.each do |tag|
-      FeedManager.instance.broadcast("hashtag:#{tag.name}", event: 'delete', payload: status.id)
+      Redis.current.publish("hashtag:#{tag.name}", Oj.dump(event: :delete, payload: status.id))
     end
   end
 
   def remove_from_public(status)
-    FeedManager.instance.broadcast(:public, event: 'delete', payload: status.id)
+    Redis.current.publish('public', Oj.dump(event: :delete, payload: status.id))
   end
 
   def redis