Hello community, here is the log from the commit of package rubygem-bunny for openSUSE:Factory checked in at 2016-11-07 12:23:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-bunny (Old) and /work/SRC/openSUSE:Factory/.rubygem-bunny.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-bunny" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-bunny/rubygem-bunny.changes 2016-09-13 22:24:32.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-bunny.new/rubygem-bunny.changes 2016-11-07 12:23:10.000000000 +0100 @@ -1,0 +2,6 @@ +Sat Oct 15 04:29:32 UTC 2016 - [email protected] + +- updated to version 2.6.0 + see installed ChangeLog.md + +------------------------------------------------------------------- Old: ---- bunny-2.5.1.gem New: ---- bunny-2.6.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-bunny.spec ++++++ --- /var/tmp/diff_new_pack.xLAql1/_old 2016-11-07 12:23:11.000000000 +0100 +++ /var/tmp/diff_new_pack.xLAql1/_new 2016-11-07 12:23:11.000000000 +0100 @@ -24,7 +24,7 @@ # Name: rubygem-bunny -Version: 2.5.1 +Version: 2.6.0 Release: 0 %define mod_name bunny %define mod_full_name %{mod_name}-%{version} ++++++ bunny-2.5.1.gem -> bunny-2.6.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.rspec new/.rspec --- old/.rspec 2016-08-15 08:02:49.000000000 +0200 +++ new/.rspec 2016-10-14 19:03:22.000000000 +0200 @@ -1,3 +1 @@ ---color ---format -progress +-c -fp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ChangeLog.md new/ChangeLog.md --- old/ChangeLog.md 2016-08-15 08:02:49.000000000 +0200 +++ new/ChangeLog.md 2016-10-14 19:03:22.000000000 +0200 @@ -1,9 +1,25 @@ -## Changes between Bunny 2.5.1 and 2.5.2 (unreleased) +## Changes between Bunny 2.5.0 and 2.6.0 (unreleased) -No changes yet. +### Graceful Shutdown of Consumers +Consumer work pool will now allow for a grace period before stopping +pool threads so that delivery processing in progress can have a chance to finish. -## Changes between Bunny 2.5.0 and 2.5.1 (August 15th, 2016) +GitHub issue: [#437](https://github.com/ruby-amqp/bunny/pull/437) + +Contributed by Stefan Sedich. + +### `Bunny::Channel#wait_for_confirms` Now Throws When Used on a Closed Channel + +GitHub issue: [#428](https://github.com/ruby-amqp/bunny/pull/428) + +Contributed by Dimitar Dimitrov. + +### Race Condition Eliminated in `Bunny::Channel#wait_for_confirms` + +GitHub issue: [#424](https://github.com/ruby-amqp/bunny/issues/424) + +Contributed by Dimitar Dimitrov. ### More Defensive Consumer Work Pool @@ -49,6 +65,8 @@ ## Changes between Bunny 2.3.0 and 2.4.0 (June 11th, 2016) +**This release includes minor breaking API changes**. + ### Unconfirmed Delivery Tag Set Reset on Network Recovery Channels will now reset their unconfirmed delivery tag set after @@ -81,6 +99,8 @@ ### More Predictable RABBITMQ_URL Handling +**This is a breaking API change**. + `RABBITMQ_URL` no longer will be used if any other connection options are provided. This makes it possible to use `RABBITMQ_URL` for some connections and options diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2016-08-15 08:02:49.000000000 +0200 +++ new/README.md 2016-10-14 19:03:22.000000000 +0200 @@ -59,7 +59,7 @@ ## Supported RabbitMQ Versions -Bunny `1.5.0` (including previews) and later versions only support RabbitMQ `3.3+`. +Bunny `1.5.0` and later versions only support RabbitMQ `3.3+`. Bunny `1.4.x` and earlier supports RabbitMQ 2.x and 3.x. @@ -88,7 +88,7 @@ To use Bunny in a project managed with Bundler: ``` ruby -gem "bunny", ">= 2.3.1" +gem "bunny", ">= 2.5.1" ``` Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/channel.rb new/lib/bunny/channel.rb --- old/lib/bunny/channel.rb 2016-08-15 08:02:49.000000000 +0200 +++ new/lib/bunny/channel.rb 2016-10-14 19:03:22.000000000 +0200 @@ -952,7 +952,7 @@ @last_basic_cancel_ok = wait_on_continuations end - maybe_kill_consumer_work_pool! unless any_consumers? + @work_pool.shutdown(true) unless any_consumers? @last_basic_cancel_ok end @@ -1790,11 +1790,9 @@ @threads_waiting_on_confirms_continuations << t begin - outstanding_confirms = false - @unconfirmed_set_mutex.synchronize do - outstanding_confirms = !@unconfirmed_set.empty? + while @unconfirmed_set_mutex.synchronize { !@unconfirmed_set.empty? } + @confirms_continuations.poll(@connection.continuation_timeout) end - @confirms_continuations.poll(@connection.continuation_timeout) if outstanding_confirms ensure @threads_waiting_on_confirms_continuations.delete(t) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/consumer_work_pool.rb new/lib/bunny/consumer_work_pool.rb --- old/lib/bunny/consumer_work_pool.rb 2016-08-15 08:02:49.000000000 +0200 +++ new/lib/bunny/consumer_work_pool.rb 2016-10-14 19:03:22.000000000 +0200 @@ -17,9 +17,12 @@ attr_reader :size attr_reader :abort_on_exception - def initialize(size = 1, abort_on_exception = false) + def initialize(size = 1, abort_on_exception = false, shutdown_timeout = 60) @size = size @abort_on_exception = abort_on_exception + @shutdown_timeout = shutdown_timeout + @shutdown_mutex = ::Mutex.new + @shutdown_conditional = ::ConditionVariable.new @queue = ::Queue.new @paused = false end @@ -53,7 +56,7 @@ [email protected]? end - def shutdown + def shutdown(wait_for_workers = false) @running = false @size.times do @@ -61,6 +64,12 @@ throw :terminate end end + + return unless wait_for_workers && @shutdown_timeout + + @shutdown_mutex.synchronize do + @shutdown_conditional.wait(@shutdown_mutex, @shutdown_timeout) + end end def join(timeout = nil) @@ -102,6 +111,10 @@ end end end + + @shutdown_mutex.synchronize do + @shutdown_conditional.signal unless busy? + end end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/session.rb new/lib/bunny/session.rb --- old/lib/bunny/session.rb 2016-08-15 08:02:49.000000000 +0200 +++ new/lib/bunny/session.rb 2016-10-14 19:03:22.000000000 +0200 @@ -337,14 +337,14 @@ # opened (this operation is very fast and inexpensive). # # @return [Bunny::Channel] Newly opened channel - def create_channel(n = nil, consumer_pool_size = 1, consumer_pool_abort_on_exception = false) + def create_channel(n = nil, consumer_pool_size = 1, consumer_pool_abort_on_exception = false, consumer_pool_shutdown_timeout = 60) raise ArgumentError, "channel number 0 is reserved in the protocol and cannot be used" if 0 == n @channel_mutex.synchronize do if n && (ch = @channels[n]) ch else - ch = Bunny::Channel.new(self, n, ConsumerWorkPool.new(consumer_pool_size || 1, consumer_pool_abort_on_exception)) + ch = Bunny::Channel.new(self, n, ConsumerWorkPool.new(consumer_pool_size || 1, consumer_pool_abort_on_exception, consumer_pool_shutdown_timeout)) ch.open ch end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/version.rb new/lib/bunny/version.rb --- old/lib/bunny/version.rb 2016-08-15 08:02:49.000000000 +0200 +++ new/lib/bunny/version.rb 2016-10-14 19:03:22.000000000 +0200 @@ -2,5 +2,5 @@ module Bunny # @return [String] Version of the library - VERSION = "2.5.1" + VERSION = "2.6.0" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2016-08-15 08:02:49.000000000 +0200 +++ new/metadata 2016-10-14 19:03:22.000000000 +0200 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: bunny version: !ruby/object:Gem::Version - version: 2.5.1 + version: 2.6.0 platform: ruby authors: - Chris Duncan @@ -12,7 +12,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2016-08-15 00:00:00.000000000 Z +date: 2016-10-14 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: amq-protocol diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/higher_level_api/integration/basic_cancel_spec.rb new/spec/higher_level_api/integration/basic_cancel_spec.rb --- old/spec/higher_level_api/integration/basic_cancel_spec.rb 2016-08-15 08:02:49.000000000 +0200 +++ new/spec/higher_level_api/integration/basic_cancel_spec.rb 2016-10-14 19:03:22.000000000 +0200 @@ -73,4 +73,66 @@ expect(delivered_data).to be_empty end end + + context "with a worker pool shutdown timeout configured" do + let(:queue_name) { "bunny.queues.#{rand}" } + + it "processes the message if processing completes within the timeout" do + delivered_data = [] + consumer = nil + + t = Thread.new do + ch = connection.create_channel(nil, 1, false, 5) + q = ch.queue(queue_name, :auto_delete => true, :durable => false) + + consumer = Bunny::Consumer.new(ch, q) + consumer.on_delivery do |_, _, payload| + sleep 2 + delivered_data << payload + end + + q.subscribe_with(consumer, :block => false) + end + t.abort_on_exception = true + sleep 1.0 + + ch = connection.create_channel + ch.default_exchange.publish("", :routing_key => queue_name) + sleep 0.7 + + consumer.cancel + sleep 1.0 + + expect(delivered_data).to_not be_empty + end + + it "kills the consumer if processing takes longer than the timeout" do + delivered_data = [] + consumer = nil + + t = Thread.new do + ch = connection.create_channel(nil, 1, false, 1) + q = ch.queue(queue_name, :auto_delete => true, :durable => false) + + consumer = Bunny::Consumer.new(ch, q) + consumer.on_delivery do |_, _, payload| + sleep 3 + delivered_data << payload + end + + q.subscribe_with(consumer, :block => false) + end + t.abort_on_exception = true + sleep 1.0 + + ch = connection.create_channel + ch.default_exchange.publish("", :routing_key => queue_name) + sleep 0.7 + + consumer.cancel + sleep 1.0 + + expect(delivered_data).to be_empty + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/higher_level_api/integration/consistent_hash_exchange_spec.rb new/spec/higher_level_api/integration/consistent_hash_exchange_spec.rb --- old/spec/higher_level_api/integration/consistent_hash_exchange_spec.rb 2016-08-15 08:02:49.000000000 +0200 +++ new/spec/higher_level_api/integration/consistent_hash_exchange_spec.rb 2016-10-14 19:03:22.000000000 +0200 @@ -1,23 +1,30 @@ # -*- coding: utf-8 -*- require "spec_helper" -unless ENV["CI"] - describe "x-consistent-hash exchange" do - let(:connection) do - c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed") - c.start - c - end - - after :each do - connection.close - end +describe "x-consistent-hash exchange" do + let(:connection) do + c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed", + :automatically_recover => true) + c.start + c + end + + let(:http_client) { RabbitMQ::HTTP::Client.new("http://127.0.0.1:15672") } + + after :each do + connection.close + end - let(:list) { Range.new(0, 6).to_a.map(&:to_s) } + let(:list) { Range.new(0, 6).to_a.map(&:to_s) } - let(:m) { 1500 } + let(:m) { 1500 } - it "distributes messages between queues bound with the same routing key" do + let(:exchange_plugin_available) do + http_client.overview.exchange_types.map(&:name).include?("x-consistent-hash") + end + + it "distributes messages between queues bound with the same routing key" do + if exchange_plugin_available ch = connection.create_channel body = "сообщение" # requires the consistent hash exchange plugin, @@ -45,6 +52,8 @@ expect(q2.message_count).to be > 100 ch.close - end - end + else + skip "x-consistent-hash exchange type isn't available" + end # if + end # it end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/higher_level_api/integration/publisher_confirms_spec.rb new/spec/higher_level_api/integration/publisher_confirms_spec.rb --- old/spec/higher_level_api/integration/publisher_confirms_spec.rb 2016-08-15 08:02:49.000000000 +0200 +++ new/spec/higher_level_api/integration/publisher_confirms_spec.rb 2016-10-14 19:03:22.000000000 +0200 @@ -124,6 +124,59 @@ end include_examples "publish confirms" + + it "returns only when all confirmations for publishes are received" do + ch = connection.create_channel + + operations_log = [] + operations_log_mutex = Mutex.new + acks_received = Queue.new + + log_acks = proc do |tag, _, is_nack| + operations_log_mutex.synchronize do + operation = "#{'n' if is_nack}ack_#{tag}" + operations_log << operation unless operations_log.include?(operation) + end + acks_received << true + end + + ch.confirm_select(log_acks) + + x = ch.default_exchange + q = ch.temporary_queue + + x.publish('msg', routing_key: q.name) + + # wait for the confirmation to arrive + acks_received.pop + + # artificially simulate a slower ack. the test should work properly even + # without this patch, but it's here just to be sure we catch it. + def (x.channel).handle_ack_or_nack(delivery_tag_before_offset, multiple, nack) + sleep 0.1 + super + end + + x.publish('msg', routing_key: q.name) + x.publish('msg', routing_key: q.name) + + if x.wait_for_confirms + operations_log_mutex.synchronize do + operations_log << 'all_confirmed' + end + end + + # wait for all the confirmations to arrive + acks_received.pop + acks_received.pop + + expect(operations_log).to eq([ + 'ack_1', + 'ack_2', + 'ack_3', + 'all_confirmed', + ]) + end end context "with a single-threaded connection" do
