mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Rejig for what's used
This commit is contained in:
parent
3e693e19c4
commit
c2e2a94306
1 changed files with 7 additions and 8 deletions
|
@ -9,12 +9,14 @@ module ActionCable
|
||||||
Broadcaster.new(self, channel)
|
Broadcaster.new(self, channel)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
def broadcasting_redis
|
||||||
def redis_for_threads
|
@broadcasting_redis ||= Redis.new(redis_config)
|
||||||
@redis_for_threads ||= Redis.new(redis_config)
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
private
|
||||||
class Broadcaster
|
class Broadcaster
|
||||||
|
attr_reader :server, :channel
|
||||||
|
|
||||||
def initialize(server, channel)
|
def initialize(server, channel)
|
||||||
@server, @channel = server, channel
|
@server, @channel = server, channel
|
||||||
end
|
end
|
||||||
|
@ -25,11 +27,8 @@ module ActionCable
|
||||||
end
|
end
|
||||||
|
|
||||||
def broadcast_without_logging(message)
|
def broadcast_without_logging(message)
|
||||||
server.redis_for_threads.publish channel, message.to_json
|
server.broadcasting_redis.publish channel, message.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
attr_reader :server, :channel
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue