nsq-ruby 2.3.1 → 2.4.1

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: 28f6367f843e0cf5a7c0728e4304099ad9847600a670e334c4915fc9e58a6dcc
4
+ data.tar.gz: ee967b3c8b66483577373a97a2b563002ab95b3dd8d461f891a4a2b03e1823b3
5
5
  SHA512:
6
- metadata.gz: 515ad2a7d29426b69e0cd4c6c0388140c0d5a75d4ea9bbb7879d34185cd8fbd0356bec49e2b6e63f6c785aae302ecc5623ca8d4b50b39704394dcaff62cdae80
7
- data.tar.gz: 3ede61bb31257542fb6ed7ce16dab944d94ebfe45b1b16d5e3cc6e09ceb01984181fef53ffacdf9052263ee5e1790cb61ca92ef0026fb710bae27837c78fdb62
6
+ metadata.gz: dff4ecce775e6a7081e6b726dbfc49e4f501a3abb65c34fadaeb585629db0daef4562937f5b1b2a3ccee1cd31e66681978e4e78efe9b1ff55f271003c3f4bf3e
7
+ data.tar.gz: 6c7dce7efa81c23dc7a19575cfe8c2badda252ff7596e0b6c9d378b1068b177378dae2054f099b25121b5bc6bbbc00dc0ef3e0c3d2df555e8cdf9dc9ce8d88c7
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/VERSION ADDED
@@ -0,0 +1 @@
1
+ 2.4.1
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
data/lib/version.rb CHANGED
@@ -1,9 +1,5 @@
1
1
  module Nsq
2
2
  module Version
3
- MAJOR = 2
4
- MINOR = 3
5
- PATCH = 1
6
- BUILD = nil
7
- STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
3
+ STRING = File.read(File.expand_path('../../VERSION', __FILE__)).strip
8
4
  end
9
5
  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.1
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
@@ -76,6 +48,7 @@ extra_rdoc_files:
76
48
  files:
77
49
  - LICENSE.txt
78
50
  - README.md
51
+ - VERSION
79
52
  - lib/nsq.rb
80
53
  - lib/nsq/client_base.rb
81
54
  - lib/nsq/connection.rb
@@ -93,7 +66,7 @@ homepage: http://github.com/wistia/nsq-ruby
93
66
  licenses:
94
67
  - MIT
95
68
  metadata: {}
96
- post_install_message:
69
+ post_install_message:
97
70
  rdoc_options: []
98
71
  require_paths:
99
72
  - lib
@@ -108,9 +81,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
81
  - !ruby/object:Gem::Version
109
82
  version: '0'
110
83
  requirements: []
111
- rubyforge_project:
112
- rubygems_version: 2.6.8
113
- signing_key:
84
+ rubygems_version: 3.1.6
85
+ signing_key:
114
86
  specification_version: 4
115
87
  summary: Ruby client library for NSQ
116
88
  test_files: []