Sha256: 76b15517a739b11aa9c7f61a21eb3f031d621883b22ed39a6c5e0969f86b12f4
Contents?: true
Size: 677 Bytes
Versions: 4
Compression:
Stored size: 677 Bytes
Contents
module RabbitFeed class Connection include Singleton def initialize RabbitFeed.log.info { { event: :connecting_to_rabbitmq, options: RabbitFeed.configuration.connection_options.merge(password: :redacted, logger: :redacted) } } @connection = Bunny.new RabbitFeed.configuration.connection_options @connection.start RabbitFeed.log.info { { event: :connected_to_rabbitmq } } @channel = @connection.create_channel @mutex = Mutex.new end private attr_reader :channel, :mutex def synchronized mutex.synchronize do yield end end def connection_in_use? mutex.locked? end end end
Version data entries
4 entries across 4 versions & 1 rubygems