Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/message_bus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ def client_message_filters
private

ENCODE_SITE_TOKEN = "$|$"
ENCODE_SITE_TOKEN_SIZE = ENCODE_SITE_TOKEN.bytesize

# encode channel name to include site
def encode_channel_name(channel, site_id = nil)
Expand All @@ -638,7 +639,14 @@ def encode_channel_name(channel, site_id = nil)
end

def decode_channel_name(channel)
channel.split(ENCODE_SITE_TOKEN)
if (idx = channel.byteindex(ENCODE_SITE_TOKEN))
[
channel.byteslice(0, idx),
channel.byteslice(idx + ENCODE_SITE_TOKEN_SIZE, channel.bytesize - idx - ENCODE_SITE_TOKEN_SIZE)
]
else
[channel, nil]
end
end

def global?(channel)
Expand Down
Loading