nsq-ruby 2.3.1 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: af8d77120d7905bfe73739801e6c7237984dfb9c
4
- data.tar.gz: b9f1bdbb317de45b6e47d1923e86e1d9295a7bc1
2
+ SHA256:
3
+ metadata.gz: e4e154c268c869f718aa9942e54f23dc6d62b7299ac26a1facb91f7f5d6d324c
4
+ data.tar.gz: 164655c96eb9730b5396c1b50000378fabf4f9e97c54dff358f33bcff6c0e7dc
5
5
  SHA512:
6
- metadata.gz: 515ad2a7d29426b69e0cd4c6c0388140c0d5a75d4ea9bbb7879d34185cd8fbd0356bec49e2b6e63f6c785aae302ecc5623ca8d4b50b39704394dcaff62cdae80
7
- data.tar.gz: 3ede61bb31257542fb6ed7ce16dab944d94ebfe45b1b16d5e3cc6e09ceb01984181fef53ffacdf9052263ee5e1790cb61ca92ef0026fb710bae27837c78fdb62
6
+ metadata.gz: f89d563ed42364550a1a301040e78ea758e563c0f867404b3d11b25f0d54917e10abfa754018c2d940fcc193dae3475e6e164544b7a141c67136e8a0d29fff68
7
+ data.tar.gz: 1b4400f790a5c16c07dd34d58e468a11e71c2026eb0567dba0584bac20d2cbe9beb227a897b69832ae0774e405cad064ed65cf318b74414ac62cf2c165586216
data/README.md CHANGED
@@ -17,7 +17,7 @@ nsq-ruby is a simple NSQ client library written in Ruby.
17
17
  ```Ruby
18
18
  require 'nsq'
19
19
  producer = Nsq::Producer.new(
20
- nsqd: '127.0.0.1:4150',
20
+ nsqd: '127.0.0.1:4150', # or ['127.0.0.1:4150']
21
21
  topic: 'some-topic'
22
22
  )
23
23
 
@@ -77,7 +77,7 @@ For example, if you'd like to publish messages to a single nsqd.
77
77
 
78
78
  ```Ruby
79
79
  producer = Nsq::Producer.new(
80
- nsqd: '6.7.8.9:4150',
80
+ nsqd: '6.7.8.9:4150', # or ['6.7.8.9:4150']
81
81
  topic: 'topic-of-great-esteem'
82
82
  )
83
83
  ```
@@ -418,4 +418,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
418
418
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
419
419
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
420
420
  SOFTWARE.
421
-
data/lib/nsq/consumer.rb CHANGED
@@ -27,7 +27,7 @@ module Nsq
27
27
 
28
28
  # This is where we keep a record of our active nsqd connections
29
29
  # The key is a string with the host and port of the instance (e.g.
30
- # '127.0.0.1:4150') and the key is the Connection instance.
30
+ # '127.0.0.1:4150') and the value is the Connection instance.
31
31
  @connections = {}
32
32
 
33
33
  if !@nsqlookupds.empty?
@@ -36,10 +36,14 @@ module Nsq
36
36
  topic: @topic,
37
37
  interval: @discovery_interval
38
38
  )
39
+
40
+ elsif opts[:nsqd]
41
+ nsqds = [opts[:nsqd]].flatten
42
+ max_per_conn = max_in_flight_per_connection(nsqds.size)
43
+ nsqds.each{|d| add_connection(d, max_in_flight: max_per_conn)}
44
+
39
45
  else
40
- # normally, we find nsqd instances to connect to via nsqlookupd(s)
41
- # in this case let's connect to an nsqd instance directly
42
- add_connection(opts[:nsqd] || '127.0.0.1:4150', max_in_flight: @max_in_flight)
46
+ add_connection('127.0.0.1:4150', max_in_flight: @max_in_flight)
43
47
  end
44
48
  end
45
49
 
data/lib/nsq/discovery.rb CHANGED
@@ -70,7 +70,7 @@ module Nsq
70
70
  uri.query = "ts=#{Time.now.to_i}"
71
71
  if topic
72
72
  uri.path = '/lookup'
73
- uri.query += "&topic=#{URI.escape(topic)}"
73
+ uri.query += "&topic=#{URI.encode_www_form_component(topic)}"
74
74
  else
75
75
  uri.path = '/nodes'
76
76
  end
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nsq-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wistia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2018-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.0'
27
- - !ruby/object:Gem::Dependency
28
- name: jeweler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.0'
41
13
  - !ruby/object:Gem::Dependency
42
14
  name: nsq-cluster
43
15
  requirement: !ruby/object:Gem::Requirement
@@ -93,7 +65,7 @@ homepage: http://github.com/wistia/nsq-ruby
93
65
  licenses:
94
66
  - MIT
95
67
  metadata: {}
96
- post_install_message:
68
+ post_install_message:
97
69
  rdoc_options: []
98
70
  require_paths:
99
71
  - lib
@@ -108,9 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
80
  - !ruby/object:Gem::Version
109
81
  version: '0'
110
82
  requirements: []
111
- rubyforge_project:
112
- rubygems_version: 2.6.8
113
- signing_key:
83
+ rubygems_version: 3.1.6
84
+ signing_key:
114
85
  specification_version: 4
115
86
  summary: Ruby client library for NSQ
116
87
  test_files: []