PERF: Move user-tips and narrative to per-user messagebus channels (#19773)

Using a shared channel with per-message permissions means that every client is updated with the channel's 'last_id', even if there are no messages available to them. Per-user channel names avoid this problem - the last_id will only be incremented when there is a message for the given user.
This commit is contained in:
David Taylor
2023-01-30 11:48:09 +00:00
committed by GitHub
parent 939c2a7371
commit 79bea9464c
5 changed files with 31 additions and 13 deletions

View File

@ -173,7 +173,11 @@ module DiscourseNarrativeBot
topic = @post.topic
post = topic.first_post
MessageBus.publish("/new_user_narrative/tutorial_search", {}, user_ids: [@user.id])
MessageBus.publish(
"/new_user_narrative/tutorial_search/#{@user.id}",
{},
user_ids: [@user.id],
)
raw = <<~MD
#{post.raw}