lib/rasti/web/broadcaster.rb in rasti-web-broadcaster-0.1.0 vs lib/rasti/web/broadcaster.rb in rasti-web-broadcaster-0.1.1

- old
+ new

@@ -13,10 +13,12 @@ attr_config :id, 'rasti.web.broadcaster' attr_config :redis_url, 'redis://localhost:6379' attr_config :logger, Logger.new(STDOUT) + @mutex = Mutex.new + class << self extend Forwardable def_delegators :broadcaster, :subscribe, @@ -24,10 +26,12 @@ :publish private def broadcaster - @broadcaster ||= ::Broadcaster.new configuration + @mutex.synchronize do + @broadcaster ||= ::Broadcaster.new configuration + end end end def initialize(app)