Refactor notifications to go through a separate stream in streaming API (#16765)

Eliminate need to have custom notifications filtering logic in the
streaming API code by publishing notifications into a separate stream
and then simply using the multi-stream capability to subscribe to that
stream when necessary
This commit is contained in:
Eugen Rochko
2021-09-26 13:23:28 +02:00
committed by GitHub
parent 52e5c07948
commit a0d4129893
2 changed files with 46 additions and 31 deletions

View File

@ -127,7 +127,7 @@ class NotifyService < BaseService
def push_notification!
return if @notification.activity.nil?
Redis.current.publish("timeline:#{@recipient.id}", Oj.dump(event: :notification, payload: InlineRenderer.render(@notification, @recipient, :notification)))
Redis.current.publish("timeline:#{@recipient.id}:notifications", Oj.dump(event: :notification, payload: InlineRenderer.render(@notification, @recipient, :notification)))
send_push_notifications!
end