PERF: Use user-specific channel for message-bus logout (#19719)

Using a shared channel means that every user receives an update to the 'last_id' when *any* other user is logged out. If many users are being programmatically logged out at the same time, this can cause a very large number of message-bus polls.

This commit switches to use a user-specific channel, which means that each user has its own 'last id' which will only increment when they are logged out
This commit is contained in:
David Taylor
2023-01-04 19:55:52 +00:00
committed by GitHub
parent 5c39e4b1c0
commit 45435cbbd5
5 changed files with 17 additions and 6 deletions

View File

@ -2020,7 +2020,7 @@ RSpec.describe User do
fab!(:user) { Fabricate(:user) }
it 'should publish the right message' do
message = MessageBus.track_publish('/logout') { user.logged_out }.first
message = MessageBus.track_publish("/logout/#{user.id}") { user.logged_out }.first
expect(message.data).to eq(user.id)
end