Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
accept site_id in all methods that later depend on it
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelniewie committed Jul 23, 2018
1 parent 64a24a9 commit cd7c752
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/message_bus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,13 @@ def publish(channel, data, opts = nil)
user_ids = nil
group_ids = nil
client_ids = nil
site_id = nil

if opts
user_ids = opts[:user_ids]
group_ids = opts[:group_ids]
client_ids = opts[:client_ids]
site_id = opts[:site_id]
end

raise ::MessageBus::InvalidMessage if (user_ids || group_ids) && global?(channel)
Expand All @@ -250,12 +252,12 @@ def publish(channel, data, opts = nil)
}
end

reliable_pub_sub.publish(encode_channel_name(channel), encoded_data, channel_opts)
reliable_pub_sub.publish(encode_channel_name(channel, site_id), encoded_data, channel_opts)
end

def blocking_subscribe(channel = nil, &blk)
def blocking_subscribe(channel = nil, site_id = nil, &blk)
if channel
reliable_pub_sub.subscribe(encode_channel_name(channel), &blk)
reliable_pub_sub.subscribe(encode_channel_name(channel, site_id), &blk)
else
reliable_pub_sub.global_subscribe(&blk)
end
Expand Down

0 comments on commit cd7c752

Please sign in to comment.