bunny 2.6.3 → 2.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -3
  3. data/ChangeLog.md +23 -2
  4. data/Gemfile +3 -3
  5. data/LICENSE +1 -1
  6. data/README.md +2 -2
  7. data/lib/bunny/channel.rb +1 -1
  8. data/lib/bunny/channel_id_allocator.rb +3 -3
  9. data/lib/bunny/concurrent/continuation_queue.rb +9 -5
  10. data/lib/bunny/exceptions.rb +6 -0
  11. data/lib/bunny/session.rb +69 -11
  12. data/lib/bunny/transport.rb +1 -1
  13. data/lib/bunny/version.rb +1 -1
  14. data/spec/higher_level_api/integration/basic_ack_spec.rb +46 -46
  15. data/spec/higher_level_api/integration/basic_cancel_spec.rb +13 -13
  16. data/spec/higher_level_api/integration/basic_consume_spec.rb +40 -40
  17. data/spec/higher_level_api/integration/basic_consume_with_objects_spec.rb +5 -5
  18. data/spec/higher_level_api/integration/basic_get_spec.rb +5 -5
  19. data/spec/higher_level_api/integration/basic_nack_spec.rb +13 -13
  20. data/spec/higher_level_api/integration/basic_publish_spec.rb +7 -7
  21. data/spec/higher_level_api/integration/basic_qos_spec.rb +1 -1
  22. data/spec/higher_level_api/integration/basic_reject_spec.rb +23 -23
  23. data/spec/higher_level_api/integration/basic_return_spec.rb +3 -3
  24. data/spec/higher_level_api/integration/channel_close_spec.rb +1 -1
  25. data/spec/higher_level_api/integration/channel_open_spec.rb +1 -1
  26. data/spec/higher_level_api/integration/connection_recovery_spec.rb +93 -55
  27. data/spec/higher_level_api/integration/connection_spec.rb +46 -46
  28. data/spec/higher_level_api/integration/connection_stop_spec.rb +9 -8
  29. data/spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb +14 -14
  30. data/spec/higher_level_api/integration/dead_lettering_spec.rb +8 -8
  31. data/spec/higher_level_api/integration/exchange_bind_spec.rb +4 -4
  32. data/spec/higher_level_api/integration/exchange_declare_spec.rb +10 -10
  33. data/spec/higher_level_api/integration/exchange_delete_spec.rb +1 -1
  34. data/spec/higher_level_api/integration/exchange_unbind_spec.rb +3 -3
  35. data/spec/higher_level_api/integration/exclusive_queue_spec.rb +5 -5
  36. data/spec/higher_level_api/integration/heartbeat_spec.rb +4 -4
  37. data/spec/higher_level_api/integration/merry_go_round_spec.rb +10 -10
  38. data/spec/higher_level_api/integration/message_properties_access_spec.rb +22 -22
  39. data/spec/higher_level_api/integration/predeclared_exchanges_spec.rb +1 -1
  40. data/spec/higher_level_api/integration/publisher_confirms_spec.rb +8 -8
  41. data/spec/higher_level_api/integration/publishing_edge_cases_spec.rb +10 -10
  42. data/spec/higher_level_api/integration/queue_bind_spec.rb +10 -10
  43. data/spec/higher_level_api/integration/queue_declare_spec.rb +14 -11
  44. data/spec/higher_level_api/integration/queue_delete_spec.rb +1 -1
  45. data/spec/higher_level_api/integration/queue_purge_spec.rb +3 -3
  46. data/spec/higher_level_api/integration/queue_unbind_spec.rb +4 -4
  47. data/spec/higher_level_api/integration/read_only_consumer_spec.rb +7 -7
  48. data/spec/higher_level_api/integration/sender_selected_distribution_spec.rb +6 -6
  49. data/spec/higher_level_api/integration/tls_connection_spec.rb +40 -40
  50. data/spec/higher_level_api/integration/tx_commit_spec.rb +1 -1
  51. data/spec/higher_level_api/integration/tx_rollback_spec.rb +1 -1
  52. data/spec/higher_level_api/integration/with_channel_spec.rb +1 -1
  53. data/spec/issues/issue100_spec.rb +7 -7
  54. data/spec/issues/issue141_spec.rb +3 -3
  55. data/spec/issues/issue224_spec.rb +3 -3
  56. data/spec/issues/issue465_spec.rb +32 -0
  57. data/spec/issues/issue78_spec.rb +11 -10
  58. data/spec/issues/issue83_spec.rb +1 -1
  59. data/spec/issues/issue97_spec.rb +20 -20
  60. data/spec/stress/channel_close_stress_spec.rb +3 -3
  61. data/spec/stress/channel_open_stress_spec.rb +3 -3
  62. data/spec/stress/channel_open_stress_with_single_threaded_connection_spec.rb +2 -1
  63. data/spec/stress/concurrent_consumers_stress_spec.rb +6 -6
  64. data/spec/stress/concurrent_publishers_stress_spec.rb +2 -1
  65. data/spec/stress/connection_open_close_spec.rb +3 -3
  66. data/spec/stress/long_running_consumer_spec.rb +7 -5
  67. data/spec/unit/concurrent/condition_spec.rb +5 -5
  68. metadata +4 -6
  69. data/spec/higher_level_api/integration/basic_recover_spec.rb +0 -18
  70. data/spec/higher_level_api/integration/consistent_hash_exchange_spec.rb +0 -59
@@ -7,7 +7,9 @@ unless ENV["CI"]
7
7
 
8
8
  describe "Long running [relatively to heartbeat interval] consumer that never publishes" do
9
9
  before :all do
10
- @connection = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed", :automatic_recovery => false, :heartbeat_interval => 6)
10
+ @connection = Bunny.new(username: "bunny_gem",
11
+ password: "bunny_password", vhost: "bunny_testbed",
12
+ automatic_recovery: false, heartbeat_interval: 6)
11
13
  @connection.start
12
14
  end
13
15
 
@@ -15,7 +17,7 @@ unless ENV["CI"]
15
17
  @connection.close
16
18
  end
17
19
 
18
- let(:target) { 512 * 1024 * 1024 }
20
+ let(:target) { 256 * 1024 * 1024 }
19
21
  let(:queue) { "bunny.stress.long_running_consumer.#{Time.now.to_i}" }
20
22
 
21
23
  let(:rate) { 50 }
@@ -30,7 +32,7 @@ unless ENV["CI"]
30
32
  t = 0
31
33
  ch = @connection.create_channel(nil, 6)
32
34
  begin
33
- q = ch.queue(queue, :exclusive => true)
35
+ q = ch.queue(queue, exclusive: true)
34
36
 
35
37
  q.bind("amq.fanout").subscribe do |_, _, payload|
36
38
  t += payload.bytesize
@@ -45,7 +47,7 @@ unless ENV["CI"]
45
47
  end
46
48
  rescue Interrupt => e
47
49
  ch.maybe_kill_consumer_work_pool!
48
- ch.close
50
+ ch.close rescue nil
49
51
  end
50
52
  end
51
53
  ct.abort_on_exception = true
@@ -68,7 +70,7 @@ unless ENV["CI"]
68
70
  sleep (s * rand)
69
71
  end
70
72
  rescue Interrupt => e
71
- ch.close
73
+ ch.close rescue nil
72
74
  end
73
75
  end
74
76
  pt.abort_on_exception = true
@@ -4,7 +4,7 @@ require "bunny/concurrent/condition"
4
4
  describe Bunny::Concurrent::Condition do
5
5
 
6
6
  describe "#wait" do
7
- 100.times do |i|
7
+ 50.times do |i|
8
8
  it "blocks current thread until notified (take #{i})" do
9
9
  condition = described_class.new
10
10
  xs = []
@@ -12,7 +12,7 @@ describe Bunny::Concurrent::Condition do
12
12
  t = Thread.new do
13
13
  xs << :notified
14
14
 
15
- sleep 0.25
15
+ sleep 0.2
16
16
  condition.notify
17
17
  end
18
18
  t.abort_on_exception = true
@@ -24,7 +24,7 @@ describe Bunny::Concurrent::Condition do
24
24
  end
25
25
 
26
26
  describe "#notify" do
27
- 100.times do |i|
27
+ 50.times do |i|
28
28
  it "notifies a single thread waiting on the latch (take #{i})" do
29
29
  mutex = Mutex.new
30
30
  condition = described_class.new
@@ -42,7 +42,7 @@ describe Bunny::Concurrent::Condition do
42
42
  end
43
43
  t2.abort_on_exception = true
44
44
 
45
- sleep 0.25
45
+ sleep 0.2
46
46
  condition.notify
47
47
  sleep 0.5
48
48
  expect(xs).to satisfy { |ys| ys.size == 1 && (ys.include?(:notified1) || ys.include?(:notified2)) }
@@ -53,7 +53,7 @@ describe Bunny::Concurrent::Condition do
53
53
  describe "#notify_all" do
54
54
  let(:n) { 30 }
55
55
 
56
- 100.times do |i|
56
+ 50.times do |i|
57
57
  it "notifies all the threads waiting on the latch (take #{i})" do
58
58
  mutex = Mutex.new
59
59
  condition = described_class.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bunny
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.3
4
+ version: 2.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Duncan
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2017-01-19 00:00:00.000000000 Z
15
+ date: 2017-03-04 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: amq-protocol
@@ -145,7 +145,6 @@ files:
145
145
  - spec/higher_level_api/integration/basic_nack_spec.rb
146
146
  - spec/higher_level_api/integration/basic_publish_spec.rb
147
147
  - spec/higher_level_api/integration/basic_qos_spec.rb
148
- - spec/higher_level_api/integration/basic_recover_spec.rb
149
148
  - spec/higher_level_api/integration/basic_reject_spec.rb
150
149
  - spec/higher_level_api/integration/basic_return_spec.rb
151
150
  - spec/higher_level_api/integration/channel_close_spec.rb
@@ -153,7 +152,6 @@ files:
153
152
  - spec/higher_level_api/integration/connection_recovery_spec.rb
154
153
  - spec/higher_level_api/integration/connection_spec.rb
155
154
  - spec/higher_level_api/integration/connection_stop_spec.rb
156
- - spec/higher_level_api/integration/consistent_hash_exchange_spec.rb
157
155
  - spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb
158
156
  - spec/higher_level_api/integration/dead_lettering_spec.rb
159
157
  - spec/higher_level_api/integration/exchange_bind_spec.rb
@@ -182,6 +180,7 @@ files:
182
180
  - spec/issues/issue141_spec.rb
183
181
  - spec/issues/issue202_spec.rb
184
182
  - spec/issues/issue224_spec.rb
183
+ - spec/issues/issue465_spec.rb
185
184
  - spec/issues/issue78_spec.rb
186
185
  - spec/issues/issue83_spec.rb
187
186
  - spec/issues/issue97_attachment.json
@@ -244,7 +243,6 @@ test_files:
244
243
  - spec/higher_level_api/integration/basic_nack_spec.rb
245
244
  - spec/higher_level_api/integration/basic_publish_spec.rb
246
245
  - spec/higher_level_api/integration/basic_qos_spec.rb
247
- - spec/higher_level_api/integration/basic_recover_spec.rb
248
246
  - spec/higher_level_api/integration/basic_reject_spec.rb
249
247
  - spec/higher_level_api/integration/basic_return_spec.rb
250
248
  - spec/higher_level_api/integration/channel_close_spec.rb
@@ -252,7 +250,6 @@ test_files:
252
250
  - spec/higher_level_api/integration/connection_recovery_spec.rb
253
251
  - spec/higher_level_api/integration/connection_spec.rb
254
252
  - spec/higher_level_api/integration/connection_stop_spec.rb
255
- - spec/higher_level_api/integration/consistent_hash_exchange_spec.rb
256
253
  - spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb
257
254
  - spec/higher_level_api/integration/dead_lettering_spec.rb
258
255
  - spec/higher_level_api/integration/exchange_bind_spec.rb
@@ -281,6 +278,7 @@ test_files:
281
278
  - spec/issues/issue141_spec.rb
282
279
  - spec/issues/issue202_spec.rb
283
280
  - spec/issues/issue224_spec.rb
281
+ - spec/issues/issue465_spec.rb
284
282
  - spec/issues/issue78_spec.rb
285
283
  - spec/issues/issue83_spec.rb
286
284
  - spec/issues/issue97_attachment.json
@@ -1,18 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Bunny::Channel, "#recover" do
4
- let(:connection) do
5
- c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
6
- c.start
7
- c
8
- end
9
-
10
- subject do
11
- connection.create_channel
12
- end
13
-
14
- it "is supported" do
15
- expect(subject.recover(true)).to be_instance_of(AMQ::Protocol::Basic::RecoverOk)
16
- expect(subject.recover(true)).to be_instance_of(AMQ::Protocol::Basic::RecoverOk)
17
- end
18
- end
@@ -1,59 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require "spec_helper"
3
-
4
- describe "x-consistent-hash exchange" do
5
- let(:connection) do
6
- c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed",
7
- :automatically_recover => true)
8
- c.start
9
- c
10
- end
11
-
12
- let(:http_client) { RabbitMQ::HTTP::Client.new("http://127.0.0.1:15672") }
13
-
14
- after :each do
15
- connection.close
16
- end
17
-
18
- let(:list) { Range.new(0, 6).to_a.map(&:to_s) }
19
-
20
- let(:m) { 1500 }
21
-
22
- let(:exchange_plugin_available) do
23
- http_client.overview.exchange_types.map(&:name).include?("x-consistent-hash")
24
- end
25
-
26
- it "distributes messages between queues bound with the same routing key" do
27
- if exchange_plugin_available
28
- ch = connection.create_channel
29
- body = "сообщение"
30
- # requires the consistent hash exchange plugin,
31
- # enable it with
32
- #
33
- # $ [sudo] rabbitmq-plugins enable rabbitmq_consistent_hash_exchange
34
- x = ch.exchange("bunny.stress.concurrent.consumers", :type => "x-consistent-hash", :durable => true)
35
-
36
- qs = []
37
-
38
- q1 = ch.queue("", :exclusive => true).bind(x, :routing_key => "5")
39
- q2 = ch.queue("", :exclusive => true).bind(x, :routing_key => "5")
40
-
41
- sleep 1.0
42
-
43
- 5.times do |i|
44
- m.times do
45
- x.publish(body, :routing_key => list.sample)
46
- end
47
- puts "Published #{(i + 1) * m} tiny messages..."
48
- end
49
-
50
- sleep 2.0
51
- expect(q1.message_count).to be > 100
52
- expect(q2.message_count).to be > 100
53
-
54
- ch.close
55
- else
56
- skip "x-consistent-hash exchange type isn't available"
57
- end # if
58
- end # it
59
- end