From cd7c752fe85a17f7e54aa950a94d7c6378a55ed1 Mon Sep 17 00:00:00 2001 From: Pawel Niewiadomski <11110000b@gmail.com> Date: Mon, 23 Jul 2018 14:42:41 +0200 Subject: [PATCH] accept site_id in all methods that later depend on it --- lib/message_bus.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/message_bus.rb b/lib/message_bus.rb index bae6b584..59b1c8ab 100644 --- a/lib/message_bus.rb +++ b/lib/message_bus.rb @@ -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) @@ -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