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 +4 -4
- data/lib/bunny/channel.rb +1 -1
- data/lib/bunny/consumer_work_pool.rb +3 -4
- data/lib/bunny/queue.rb +4 -6
- data/lib/bunny/session.rb +5 -1
- data/lib/bunny/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8794b01931d06fc7298999f5651a00e3703b9eda18ff145d668464aeadd0cf65
|
|
4
|
+
data.tar.gz: 23c03916fdfffa1d9812fd200350cb7f00a8c066a641a4fcbd8c92076da3b63e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
#
|
|
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
|
-
|
|
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
|
-
#
|
|
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
|
-
|
|
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
|
-
|
|
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