DEV: Centralize user updates to a single MessageBus channel. (#17058)

Introduces an interface to publish user updates on the server side and
helps to reduce the growing number of subscriptions on the client side.
This commit is contained in:
Alan Guo Xiang Tan
2022-06-13 14:27:43 +08:00
committed by GitHub
parent bd32656157
commit 94c3bbc2d1
9 changed files with 92 additions and 49 deletions

View File

@ -174,9 +174,9 @@ describe PostCreator do
"/latest",
"/topic/#{created_post.topic_id}",
"/topic/#{created_post.topic_id}",
"/user-drafts/#{admin.id}",
"/user-drafts/#{admin.id}",
"/user-drafts/#{admin.id}",
User.publish_updates_channel(admin.id),
User.publish_updates_channel(admin.id),
User.publish_updates_channel(admin.id),
].sort
)
@ -205,7 +205,7 @@ describe PostCreator do
user_action = messages.find { |m| m.channel == "/u/#{p.user.username}" }
expect(user_action).not_to eq(nil)
draft_count = messages.find { |m| m.channel == "/user-drafts/#{p.user_id}" }
draft_count = messages.find { |m| m.channel == User.publish_updates_channel(p.user_id) }
expect(draft_count).not_to eq(nil)
expect(messages.filter { |m| m.channel != "/distributed_hash" }.length).to eq(7)