bunny 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ChangeLog.md +18 -0
- data/lib/bunny/channel.rb +4 -3
- data/lib/bunny/channel_id_allocator.rb +2 -1
- data/lib/bunny/concurrent/condition.rb +2 -1
- data/lib/bunny/heartbeat_sender.rb +1 -1
- data/lib/bunny/reader_loop.rb +1 -1
- data/lib/bunny/session.rb +9 -2
- data/lib/bunny/transport.rb +2 -1
- data/lib/bunny/version.rb +1 -1
- data/spec/higher_level_api/integration/connection_stop_spec.rb +7 -9
- data/spec/stress/connection_open_close_spec.rb +17 -0
- metadata +16 -23
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7580b7ff949410f73fe0dd0d4425d19dd0b8b911
|
4
|
+
data.tar.gz: a6121f81e944a8765cb20ad27c2f2c9aecc38009
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a773f870cdaaec57396812d6120a10052e74468f939f9f587d807755330ac21940248e6166fd46c710969dff365e23eb927bac3cad95fc25e6c07fa66cf8e04a
|
7
|
+
data.tar.gz: 75a2d552c4748e98424f8ce156eb37465550329ffe078184ecdf7103132ce9c8fedf615c8b8048491af018f3ceea2ec4b5f8399107b2e28a427fc544f8175630
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
## Changes between Bunny 0.9.6 and 0.9.7
|
2
|
+
|
3
|
+
### Reentrant Mutex Implementation
|
4
|
+
|
5
|
+
Bunny now allows mutex impl to be configurable, uses reentrant Monitor
|
6
|
+
by default.
|
7
|
+
|
8
|
+
Non-reentrant mutexes is a major PITA and may affect code that
|
9
|
+
uses Bunny.
|
10
|
+
|
11
|
+
Avg. publishing throughput with Monitor drops slightly from
|
12
|
+
5.73 Khz to 5.49 Khz (about 4% decrease), which is reasonable
|
13
|
+
for Bunny.
|
14
|
+
|
15
|
+
Apps that need these 4% can configure what mutex implementation
|
16
|
+
is used on per-connection basis.
|
17
|
+
|
18
|
+
|
1
19
|
## Changes between Bunny 0.9.5 and 0.9.6
|
2
20
|
|
3
21
|
### Eliminated Race Condition in Bunny::Session#close
|
data/lib/bunny/channel.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require "thread"
|
3
|
+
require "monitor"
|
3
4
|
require "set"
|
4
5
|
|
5
6
|
require "bunny/consumer_work_pool"
|
@@ -173,10 +174,10 @@ module Bunny
|
|
173
174
|
@work_pool = work_pool
|
174
175
|
|
175
176
|
# synchronizes frameset delivery. MK.
|
176
|
-
@publishing_mutex =
|
177
|
-
@consumer_mutex =
|
177
|
+
@publishing_mutex = @connection.mutex_impl.new
|
178
|
+
@consumer_mutex = @connection.mutex_impl.new
|
178
179
|
|
179
|
-
@unconfirmed_set_mutex =
|
180
|
+
@unconfirmed_set_mutex = @connection.mutex_impl.new
|
180
181
|
|
181
182
|
self.reset_continuations
|
182
183
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "thread"
|
2
|
+
require "monitor"
|
2
3
|
require "amq/int_allocator"
|
3
4
|
|
4
5
|
module Bunny
|
@@ -18,7 +19,7 @@ module Bunny
|
|
18
19
|
# @param [Integer] max_channel Max allowed channel id
|
19
20
|
def initialize(max_channel = ((1 << 16) - 1))
|
20
21
|
@allocator = AMQ::IntAllocator.new(1, max_channel)
|
21
|
-
@mutex =
|
22
|
+
@mutex = Monitor.new
|
22
23
|
end
|
23
24
|
|
24
25
|
|
data/lib/bunny/reader_loop.rb
CHANGED
data/lib/bunny/session.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "socket"
|
2
2
|
require "thread"
|
3
|
+
require "monitor"
|
3
4
|
|
4
5
|
require "bunny/transport"
|
5
6
|
require "bunny/channel_id_allocator"
|
@@ -144,11 +145,14 @@ module Bunny
|
|
144
145
|
@mechanism = opts.fetch(:auth_mechanism, "PLAIN")
|
145
146
|
@credentials_encoder = credentials_encoder_for(@mechanism)
|
146
147
|
@locale = @opts.fetch(:locale, DEFAULT_LOCALE)
|
148
|
+
|
149
|
+
@mutex_impl = @opts.fetch(:mutex_impl, Monitor)
|
150
|
+
|
147
151
|
# mutex for the channel id => channel hash
|
148
|
-
@channel_mutex =
|
152
|
+
@channel_mutex = @mutex_impl.new
|
149
153
|
# transport operations/continuations mutex. A workaround for
|
150
154
|
# the non-reentrant Ruby mutexes. MK.
|
151
|
-
@transport_mutex =
|
155
|
+
@transport_mutex = @mutex_impl.new
|
152
156
|
@channels = Hash.new
|
153
157
|
|
154
158
|
@origin_thread = Thread.current
|
@@ -186,6 +190,9 @@ module Bunny
|
|
186
190
|
@threaded
|
187
191
|
end
|
188
192
|
|
193
|
+
# @private
|
194
|
+
attr_reader :mutex_impl
|
195
|
+
|
189
196
|
def configure_socket(&block)
|
190
197
|
raise ArgumentError, "No block provided!" if block.nil?
|
191
198
|
|
data/lib/bunny/transport.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "socket"
|
2
2
|
require "thread"
|
3
|
+
require "monitor"
|
3
4
|
|
4
5
|
begin
|
5
6
|
require "openssl"
|
@@ -49,7 +50,7 @@ module Bunny
|
|
49
50
|
@connect_timeout = nil if @connect_timeout == 0
|
50
51
|
@disconnect_timeout = @read_write_timeout || @connect_timeout
|
51
52
|
|
52
|
-
@writes_mutex =
|
53
|
+
@writes_mutex = @session.mutex_impl.new
|
53
54
|
|
54
55
|
maybe_initialize_socket
|
55
56
|
prepare_tls_context if @tls_enabled
|
data/lib/bunny/version.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Bunny::Session do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
ch = c.create_channel
|
4
|
+
it "can be closed" do
|
5
|
+
c = Bunny.new(:automatically_recover => false)
|
6
|
+
c.start
|
7
|
+
ch = c.create_channel
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
9
|
+
c.should be_connected
|
10
|
+
c.stop
|
11
|
+
c.should be_closed
|
14
12
|
end
|
15
13
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
unless RUBY_ENGINE == "jruby"
|
4
|
+
describe Bunny::Session do
|
5
|
+
4000.times do |i|
|
6
|
+
it "can be closed (take #{i})" do
|
7
|
+
c = Bunny.new(:automatically_recover => false)
|
8
|
+
c.start
|
9
|
+
ch = c.create_channel
|
10
|
+
|
11
|
+
c.should be_connected
|
12
|
+
c.stop
|
13
|
+
c.should be_closed
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bunny
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
5
|
-
prerelease:
|
4
|
+
version: 0.9.7
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Chris Duncan
|
@@ -13,36 +12,29 @@ authors:
|
|
13
12
|
autorequire:
|
14
13
|
bindir: bin
|
15
14
|
cert_chain: []
|
16
|
-
date: 2013-07-
|
15
|
+
date: 2013-07-26 00:00:00.000000000 Z
|
17
16
|
dependencies:
|
18
17
|
- !ruby/object:Gem::Dependency
|
19
18
|
name: amq-protocol
|
20
19
|
requirement: !ruby/object:Gem::Requirement
|
21
|
-
none: false
|
22
20
|
requirements:
|
23
|
-
- -
|
21
|
+
- - '>='
|
24
22
|
- !ruby/object:Gem::Version
|
25
23
|
version: 1.6.0
|
26
24
|
type: :runtime
|
27
25
|
prerelease: false
|
28
26
|
version_requirements: !ruby/object:Gem::Requirement
|
29
|
-
none: false
|
30
27
|
requirements:
|
31
|
-
- -
|
28
|
+
- - '>='
|
32
29
|
- !ruby/object:Gem::Version
|
33
30
|
version: 1.6.0
|
34
31
|
description: Easy to use, feature complete Ruby client for RabbitMQ 2.0.
|
35
32
|
email:
|
36
|
-
-
|
37
|
-
|
38
|
-
-
|
39
|
-
|
40
|
-
-
|
41
|
-
c3Rhc3RueUAxMDFpZGVhcy5jeg==
|
42
|
-
- !binary |-
|
43
|
-
bWljaGFlbEBub3ZlbWJlcmFpbi5jb20=
|
44
|
-
- !binary |-
|
45
|
-
c2thZXNAcmFpbHNleHByZXNzLmRl
|
33
|
+
- celldee@gmail.com
|
34
|
+
- eric@5stops.com
|
35
|
+
- stastny@101ideas.cz
|
36
|
+
- michael@novemberain.com
|
37
|
+
- skaes@railsexpress.de
|
46
38
|
executables: []
|
47
39
|
extensions: []
|
48
40
|
extra_rdoc_files:
|
@@ -181,6 +173,7 @@ files:
|
|
181
173
|
- spec/stress/channel_open_stress_with_single_threaded_connection_spec.rb
|
182
174
|
- spec/stress/concurrent_consumers_stress_spec.rb
|
183
175
|
- spec/stress/concurrent_publishers_stress_spec.rb
|
176
|
+
- spec/stress/connection_open_close_spec.rb
|
184
177
|
- spec/stress/long_running_consumer_spec.rb
|
185
178
|
- spec/tls/cacert.pem
|
186
179
|
- spec/tls/client_cert.pem
|
@@ -193,27 +186,26 @@ files:
|
|
193
186
|
homepage: http://rubybunny.info
|
194
187
|
licenses:
|
195
188
|
- MIT
|
189
|
+
metadata: {}
|
196
190
|
post_install_message:
|
197
191
|
rdoc_options: []
|
198
192
|
require_paths:
|
199
193
|
- lib
|
200
194
|
required_ruby_version: !ruby/object:Gem::Requirement
|
201
|
-
none: false
|
202
195
|
requirements:
|
203
|
-
- -
|
196
|
+
- - '>='
|
204
197
|
- !ruby/object:Gem::Version
|
205
198
|
version: '0'
|
206
199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
|
-
none: false
|
208
200
|
requirements:
|
209
|
-
- -
|
201
|
+
- - '>='
|
210
202
|
- !ruby/object:Gem::Version
|
211
203
|
version: '0'
|
212
204
|
requirements: []
|
213
205
|
rubyforge_project:
|
214
|
-
rubygems_version:
|
206
|
+
rubygems_version: 2.0.5
|
215
207
|
signing_key:
|
216
|
-
specification_version:
|
208
|
+
specification_version: 4
|
217
209
|
summary: Popular easy to use Ruby client for RabbitMQ
|
218
210
|
test_files:
|
219
211
|
- spec/compatibility/queue_declare_spec.rb
|
@@ -269,6 +261,7 @@ test_files:
|
|
269
261
|
- spec/stress/channel_open_stress_with_single_threaded_connection_spec.rb
|
270
262
|
- spec/stress/concurrent_consumers_stress_spec.rb
|
271
263
|
- spec/stress/concurrent_publishers_stress_spec.rb
|
264
|
+
- spec/stress/connection_open_close_spec.rb
|
272
265
|
- spec/stress/long_running_consumer_spec.rb
|
273
266
|
- spec/tls/cacert.pem
|
274
267
|
- spec/tls/client_cert.pem
|