garaio_bunny 2.19.1 → 2.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6968f28e951ec5f7c22a54027c77e34ed1ed3cc0a192d8a349c3bd433f31765e
4
- data.tar.gz: be7bdd9c7913c0055dfb4ebfda34fe494bcd8f18732afe105a6b5bc04979bc1a
3
+ metadata.gz: 8794b01931d06fc7298999f5651a00e3703b9eda18ff145d668464aeadd0cf65
4
+ data.tar.gz: 23c03916fdfffa1d9812fd200350cb7f00a8c066a641a4fcbd8c92076da3b63e
5
5
  SHA512:
6
- metadata.gz: 1cdd517b7aa747e75c847cdd65a58fbd4c80b7e3e113d856d96936795aa9eab53d246c5a2f6dae097ca4a40f5e650e7b826e88bf5abaccb239a3de0ee8cccf06
7
- data.tar.gz: 0c9cfb087ea822402c4383ac1438afb5ea92d5031a065eb29ec3fd9c4082476d312ceb8b07abb3834e3b7e0bb3dc325b250c50e8e2584e99c0087d15cef4932b
6
+ metadata.gz: 5db65b001870cdfea5658dd56b7219ef1f3007bf3d4a2c6c3e345f0d3438b3bff661fb00faaca6f3fb375d168da30c2ca12172873607a7cfcb18adcc87d46655
7
+ data.tar.gz: 82451e78bb5daf3f838c3969511797c3dd5646f3c77fbe76ca01d02063b432a713cc32922270ceb4c7bf021cb0c26ae877bb4218b3db292c7021bbca72fc123e
data/lib/bunny/channel.rb CHANGED
@@ -165,7 +165,7 @@ module Bunny
165
165
  # @param [Bunny::Session] connection AMQP 0.9.1 connection
166
166
  # @param [Integer] id Channel id, pass nil to make Bunny automatically allocate it
167
167
  # @param [Bunny::ConsumerWorkPool] work_pool Thread pool for delivery processing, by default of size 1
168
- def initialize(connection = nil, id = nil, work_pool = ConsumerWorkPool.new(1))
168
+ def initialize(connection = nil, id = nil, work_pool = ConsumerWorkPool.new(1, logger: connection&.logger))
169
169
  @connection = connection
170
170
  @logger = connection.logger
171
171
  @id = id || @connection.next_channel_id
@@ -17,7 +17,7 @@ module Bunny
17
17
  attr_reader :size
18
18
  attr_reader :abort_on_exception
19
19
 
20
- def initialize(size = 1, abort_on_exception = false, shutdown_timeout = 60)
20
+ def initialize(size = 1, abort_on_exception = false, shutdown_timeout = 60, logger:)
21
21
  @size = size
22
22
  @abort_on_exception = abort_on_exception
23
23
  @shutdown_timeout = shutdown_timeout
@@ -26,6 +26,7 @@ module Bunny
26
26
  @queue = ::Queue.new
27
27
  @paused = false
28
28
  @running = false
29
+ @logger = logger
29
30
  end
30
31
 
31
32
 
@@ -107,9 +108,7 @@ module Bunny
107
108
  begin
108
109
  callable.call
109
110
  rescue ::StandardError => e
110
- # TODO: use connection logger
111
- $stderr.puts e.class.name
112
- $stderr.puts e.message
111
+ @logger&.error("Uncaught exception in #{self.class}: #{e.inspect} @ #{e.backtrace[0]}")
113
112
  end
114
113
  end
115
114
  end
data/lib/bunny/queue.rb CHANGED
@@ -35,6 +35,7 @@ module Bunny
35
35
  # old Bunny versions pass a connection here. In that case,
36
36
  # we just use default channel from it. MK.
37
37
  @channel = channel
38
+ @logger = channel.connection.logger
38
39
  @name = name
39
40
  @options = self.class.add_default_options(name, opts)
40
41
 
@@ -337,15 +338,13 @@ module Bunny
337
338
  @channel.deregister_queue_named(old_name)
338
339
  end
339
340
 
340
- # TODO: inject and use logger
341
- # puts "Recovering queue #{@name}"
341
+ logger.info("Recovering queue #{@name}")
342
342
  begin
343
343
  declare! unless @options[:no_declare]
344
344
 
345
345
  @channel.register_queue(self)
346
346
  rescue Exception => e
347
- # TODO: inject and use logger
348
- puts "Caught #{e.inspect} while redeclaring and registering #{@name}!"
347
+ @logger.error("Caught #{e.inspect} while redeclaring and registering #{@name}!")
349
348
  end
350
349
  recover_bindings
351
350
  end
@@ -353,8 +352,7 @@ module Bunny
353
352
  # @private
354
353
  def recover_bindings
355
354
  @bindings.each do |b|
356
- # TODO: inject and use logger
357
- # puts "Recovering binding #{b.inspect}"
355
+ @logger.info("Recovering binding #{b.inspect}")
358
356
  self.bind(b[:exchange], b)
359
357
  end
360
358
  end
data/lib/bunny/session.rb CHANGED
@@ -380,7 +380,11 @@ module Bunny
380
380
  if n && (ch = @channels[n])
381
381
  ch
382
382
  else
383
- ch = Bunny::Channel.new(self, n, ConsumerWorkPool.new(consumer_pool_size || 1, consumer_pool_abort_on_exception, consumer_pool_shutdown_timeout))
383
+ work_pool = ConsumerWorkPool.new(consumer_pool_size || 1,
384
+ consumer_pool_abort_on_exception,
385
+ consumer_pool_shutdown_timeout,
386
+ logger: logger)
387
+ ch = Bunny::Channel.new(self, n, work_pool)
384
388
  ch.open
385
389
  ch
386
390
  end
data/lib/bunny/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Bunny
4
4
  # @return [String] Version of the library
5
- VERSION = "2.19.1"
5
+ VERSION = "2.19.2"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: garaio_bunny
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.1
4
+ version: 2.19.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Duncan