From 49e533244c01d17a299844df1f6bf5866981fdf2 Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Thu, 11 Jul 2019 12:11:57 -0400 Subject: [PATCH] Updated all Redis.current.publish, PushUpdateWorker.perform_async to work again added back now that we will have timeline/notification queueing functionality --- app/lib/feed_manager.rb | 4 ++-- app/services/fan_out_on_write_service.rb | 10 +++++----- app/workers/push_conversation_worker.rb | 2 +- app/workers/push_update_worker.rb | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 02e9cb64..c903f9d1 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -30,7 +30,7 @@ class FeedManager def push_to_home(account, status) return false unless add_to_feed(:home, account.id, status, account.user&.aggregates_reblogs?) trim(:home, account.id) - #PushUpdateWorker.perform_async(account.id, status.id, "timeline:#{account.id}") if push_update_required?("timeline:#{account.id}") + PushUpdateWorker.perform_async(account.id, status.id, "timeline:#{account.id}") if push_update_required?("timeline:#{account.id}") true end @@ -48,7 +48,7 @@ class FeedManager end return false unless add_to_feed(:list, list.id, status, list.account.user&.aggregates_reblogs?) trim(:list, list.id) - #PushUpdateWorker.perform_async(list.account_id, status.id, "timeline:list:#{list.id}") if push_update_required?("timeline:list:#{list.id}") + PushUpdateWorker.perform_async(list.account_id, status.id, "timeline:list:#{list.id}") if push_update_required?("timeline:list:#{list.id}") true end diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index ea5e4788..f62fa66d 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -61,7 +61,7 @@ class FanOutOnWriteService < BaseService Rails.logger.debug "Delivering status #{status.id} to group" - # Redis.current.publish("timeline:group:#{status.group_id}", @payload) + Redis.current.publish("timeline:group:#{status.group_id}", @payload) end def deliver_to_mentioned_followers(status) @@ -89,15 +89,15 @@ class FanOutOnWriteService < BaseService def deliver_to_public(status) Rails.logger.debug "Delivering status #{status.id} to public timeline" - # Redis.current.publish('timeline:public', @payload) - # Redis.current.publish('timeline:public:local', @payload) if status.local? + Redis.current.publish('timeline:public', @payload) + Redis.current.publish('timeline:public:local', @payload) if status.local? end def deliver_to_media(status) Rails.logger.debug "Delivering status #{status.id} to media timeline" - # Redis.current.publish('timeline:public:media', @payload) - # Redis.current.publish('timeline:public:local:media', @payload) if status.local? + Redis.current.publish('timeline:public:media', @payload) + Redis.current.publish('timeline:public:local:media', @payload) if status.local? end def deliver_to_own_conversation(status) diff --git a/app/workers/push_conversation_worker.rb b/app/workers/push_conversation_worker.rb index f7a1c7a1..77f5895c 100644 --- a/app/workers/push_conversation_worker.rb +++ b/app/workers/push_conversation_worker.rb @@ -7,7 +7,7 @@ class PushConversationWorker conversation = AccountConversation.find(conversation_account_id) message = InlineRenderer.render(conversation, conversation.account, :conversation) timeline_id = "timeline:direct:#{conversation.account_id}" - # Redis.current.publish(timeline_id, Oj.dump(event: :conversation, payload: message, queued_at: (Time.now.to_f * 1000.0).to_i)) + Redis.current.publish(timeline_id, Oj.dump(event: :conversation, payload: message, queued_at: (Time.now.to_f * 1000.0).to_i)) true rescue ActiveRecord::RecordNotFound true diff --git a/app/workers/push_update_worker.rb b/app/workers/push_update_worker.rb index 6ed4906b..a491848e 100644 --- a/app/workers/push_update_worker.rb +++ b/app/workers/push_update_worker.rb @@ -9,7 +9,7 @@ class PushUpdateWorker message = InlineRenderer.render(status, account, :status) timeline_id = "timeline:#{account.id}" if timeline_id.nil? - # Redis.current.publish(timeline_id, Oj.dump(event: :update, payload: message, queued_at: (Time.now.to_f * 1000.0).to_i)) + Redis.current.publish(timeline_id, Oj.dump(event: :update, payload: message, queued_at: (Time.now.to_f * 1000.0).to_i)) true rescue ActiveRecord::RecordNotFound true