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

This reverts commit 94c3bbc2d1.

At this current point in time, we do not have enough data on whether
this centralisation is the trade-offs of coupling features into a single
channel.
This commit is contained in:
Alan Guo Xiang Tan
2022-06-17 12:24:15 +08:00
committed by GitHub
parent 4c810ca121
commit f618fdf17f
9 changed files with 47 additions and 85 deletions

View File

@@ -214,13 +214,13 @@ class UserStat < ActiveRecord::Base
RETURNING draft_count, (SELECT 1 FROM drafts WHERE user_id = :user_id AND draft_key = :new_topic)
SQL
User.publish_updates(
user_id: user_id,
type: User::PUBLISH_DRAFTS_TYPE,
payload: {
MessageBus.publish(
"/user-drafts/#{user_id}",
{
draft_count: draft_count,
has_topic_draft: !!has_topic_draft
}
},
user_ids: [user_id]
)
else
DB.exec <<~SQL