fastly_nsq 1.9.3 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog.md +9 -1
- data/README.md +3 -0
- data/lib/fastly_nsq.rb +15 -0
- data/lib/fastly_nsq/message.rb +5 -0
- data/lib/fastly_nsq/version.rb +1 -1
- data/spec/message_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50a60efb4df61a42c1a86afc21062375622f93e3d68d8f0c6f08ff60e44aa57b
|
4
|
+
data.tar.gz: effddde6ad0930afb14c007f03aada0637437651ccd62b36c1b5a1b5b84a4344
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3a447b9a80c310994775ebd89d13bcdde8ccd4f9d9defa4891f9a67d62a2a4ac63c79a0dffaa93c906721e5e2e90504fdefc8ca7137740c23e1509ef64003ef
|
7
|
+
data.tar.gz: 2b602098ff5095cba6c8fc1f02ec9cdd693c4cc0ba7361fe43a1a63b5b641218016b086da426c3052ffd40758e2a6abf865733f7bcbd894f9f2dff1a14c01725
|
data/ChangeLog.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v1.10.0](https://github.com/fastly/fastly_nsq/tree/HEAD)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/fastly/fastly_nsq/compare/v1.9.3...v1.10.0)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- add max\_req\_timeout \[IE-2040\] [\#85](https://github.com/fastly/fastly_nsq/pull/85) ([leklund](https://github.com/leklund))
|
10
|
+
|
3
11
|
## [v1.9.3](https://github.com/fastly/fastly_nsq/tree/v1.9.3) (2018-07-13)
|
4
12
|
[Full Changelog](https://github.com/fastly/fastly_nsq/compare/v1.9.2...v1.9.3)
|
5
13
|
|
@@ -373,4 +381,4 @@
|
|
373
381
|
## [v0.0.1](https://github.com/fastly/fastly_nsq/tree/v0.0.1) (2016-01-30)
|
374
382
|
|
375
383
|
|
376
|
-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
384
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/README.md
CHANGED
@@ -157,6 +157,9 @@ FastlyNsq.configure do |config|
|
|
157
157
|
config.logger = Logger.new
|
158
158
|
config.preprocessor = ->(_) { FastlyNsq.logger.info 'PREPROCESSESES' }
|
159
159
|
|
160
|
+
config.max_attempts = 20
|
161
|
+
config.max_req_timeout = (60 * 60 * 4 * 1_000) # 4 hours
|
162
|
+
|
160
163
|
lc.listen 'posts', ->(m) { puts "posts: #{m.body}" }
|
161
164
|
lc.listen 'blogs', ->(m) { puts "blogs: #{m.body}" }, priority: 3
|
162
165
|
end
|
data/lib/fastly_nsq.rb
CHANGED
@@ -26,6 +26,10 @@ module FastlyNsq
|
|
26
26
|
# @return [Integer]
|
27
27
|
attr_accessor :max_attempts
|
28
28
|
|
29
|
+
# Set Maximum requeue timeout in milliseconds
|
30
|
+
# @return [Integer]
|
31
|
+
attr_writer :max_req_timeout
|
32
|
+
|
29
33
|
# @return [Logger]
|
30
34
|
attr_writer :logger
|
31
35
|
|
@@ -87,6 +91,17 @@ module FastlyNsq
|
|
87
91
|
@manager = manager
|
88
92
|
end
|
89
93
|
|
94
|
+
##
|
95
|
+
# Maximum requeue timeout in milliseconds. This setting controls the
|
96
|
+
# maximum value that will be sent from FastlyNsq::Message#requeue This
|
97
|
+
# value should be less than or equal to the nsqd command line option
|
98
|
+
# +max-req-timeout+. The default setting is 1 hour.
|
99
|
+
# @return [Integer]
|
100
|
+
# @see https://nsq.io/components/nsqd.html#command-line-options
|
101
|
+
def max_req_timeout
|
102
|
+
@max_req_timeout ||= ENV.fetch('MAX_REQ_TIMEOUT', 60 * 60 * 1_000)
|
103
|
+
end
|
104
|
+
|
90
105
|
##
|
91
106
|
# Return an array of NSQ lookupd http addresses sourced from ENV['NSQLOOKUPD_HTTP_ADDRESS']
|
92
107
|
# @return [Array<String>] list of nsqlookupd http addresses
|
data/lib/fastly_nsq/message.rb
CHANGED
@@ -64,11 +64,16 @@ class FastlyNsq::Message
|
|
64
64
|
|
65
65
|
##
|
66
66
|
# Requeue an NSQ Message
|
67
|
+
# If the +timeout+ parameter or the caclulated backoff is greater
|
68
|
+
# than FastlyNsq.max_req_timeout, the +max_req_timeout+ will be used
|
69
|
+
# to requeue the message.
|
67
70
|
# @param timeout [Integer] timeout in milliseconds
|
68
71
|
def requeue(timeout = nil)
|
69
72
|
return managed if managed
|
70
73
|
timeout ||= requeue_period
|
71
74
|
|
75
|
+
timeout = [timeout, FastlyNsq.max_req_timeout].min
|
76
|
+
|
72
77
|
@managed = :requeued
|
73
78
|
nsq_message.requeue(timeout)
|
74
79
|
end
|
data/lib/fastly_nsq/version.rb
CHANGED
data/spec/message_spec.rb
CHANGED
@@ -69,4 +69,10 @@ RSpec.describe FastlyNsq::Message do
|
|
69
69
|
|
70
70
|
subject.requeue
|
71
71
|
end
|
72
|
+
|
73
|
+
it 'uses the FastlyNsq.max_req_timeout it timeout is larger than FastlyNsq.max_req_timeout' do
|
74
|
+
expect(nsq_message).to receive(:requeue).with(60 * 60 * 1_000)
|
75
|
+
|
76
|
+
subject.requeue(60 * 60 * 4 * 1_000)
|
77
|
+
end
|
72
78
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastly_nsq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tommy O'Neil
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2018-07-
|
16
|
+
date: 2018-07-23 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: awesome_print
|