shoryuken 3.0.3 → 3.0.4
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 +7 -0
- data/bin/cli/sqs.rb +11 -4
- data/bin/shoryuken +2 -2
- data/lib/shoryuken/manager.rb +17 -17
- data/lib/shoryuken/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1367b27e316c258563ef328b78bc64947c849d8
|
4
|
+
data.tar.gz: 285db9748d737bfe07a6904db381d3c11883cd05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f85154f339098c0b04a01673548b0c688217290772131dc28a1ed0c378b0cb671576f5a195143d915a8ab70ed836b089bd12ff6c4d6aa78d81bf858729323a6
|
7
|
+
data.tar.gz: 9b5180a9baf239178c11afcc7f55d31392162deeb95aa7f49836a64e94fcc114b145ba82414b83ad22d278612d3cca53436bb804d41d98ccfbe9f1eea4f678cc
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [v3.0.4] - 2017-03-24
|
2
|
+
- Add `sqs purge` command. See https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_PurgeQueue.html
|
3
|
+
- [#344](https://github.com/phstc/shoryuken/pull/344)
|
4
|
+
|
5
|
+
- Fix "Thread exhaustion" error. This issue was most noticed when using long polling. @waynerobinson :beers: for pairing up on this.
|
6
|
+
- [#345](https://github.com/phstc/shoryuken/pull/345)
|
7
|
+
|
1
8
|
## [v3.0.3] - 2017-03-19
|
2
9
|
- Update `sqs` CLI commands to use `get_queue_url` when appropriated
|
3
10
|
- [#341](https://github.com/phstc/shoryuken/pull/341)
|
data/bin/cli/sqs.rb
CHANGED
@@ -92,7 +92,7 @@ module Shoryuken
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
-
desc 'ls [QUEUE-NAME-PREFIX]', '
|
95
|
+
desc 'ls [QUEUE-NAME-PREFIX]', 'Lists queues'
|
96
96
|
method_option :watch, aliases: '-w', type: :boolean, desc: 'watch queues'
|
97
97
|
method_option :watch_interval, type: :numeric, default: 10, desc: 'watch interval'
|
98
98
|
def ls(queue_name_prefix = '')
|
@@ -110,7 +110,7 @@ module Shoryuken
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
desc 'dump QUEUE-NAME', '
|
113
|
+
desc 'dump QUEUE-NAME', 'Dumps messages from a queue into a JSON lines file'
|
114
114
|
method_option :number, aliases: '-n', type: :numeric, default: Float::INFINITY, desc: 'number of messages to dump'
|
115
115
|
method_option :path, aliases: '-p', type: :string, default: './', desc: 'path to save the dump file'
|
116
116
|
method_option :delete, aliases: '-d', type: :boolean, default: true, desc: 'delete from the queue'
|
@@ -144,7 +144,7 @@ module Shoryuken
|
|
144
144
|
file.close if file
|
145
145
|
end
|
146
146
|
|
147
|
-
desc 'requeue QUEUE-NAME PATH', '
|
147
|
+
desc 'requeue QUEUE-NAME PATH', 'Requeues messages from a dump file'
|
148
148
|
def requeue(queue_name, path)
|
149
149
|
fail_task "Path #{path} not found" unless File.exist?(path)
|
150
150
|
|
@@ -155,7 +155,7 @@ module Shoryuken
|
|
155
155
|
say "Requeued #{messages.size} messages from #{path} to #{queue_name}", :green
|
156
156
|
end
|
157
157
|
|
158
|
-
desc 'mv QUEUE-NAME-SOURCE QUEUE-NAME-TARGET', '
|
158
|
+
desc 'mv QUEUE-NAME-SOURCE QUEUE-NAME-TARGET', 'Moves messages from one queue (source) to another (target)'
|
159
159
|
method_option :number, aliases: '-n', type: :numeric, default: Float::INFINITY, desc: 'number of messages to move'
|
160
160
|
method_option :delete, aliases: '-d', type: :boolean, default: true, desc: 'delete from the queue'
|
161
161
|
def mv(queue_name_source, queue_name_target)
|
@@ -175,6 +175,13 @@ module Shoryuken
|
|
175
175
|
say "Moved #{count} messages from #{queue_name_source} to #{queue_name_target}", :green
|
176
176
|
end
|
177
177
|
end
|
178
|
+
|
179
|
+
desc 'purge QUEUE-NAME', 'Deletes the messages in a queue'
|
180
|
+
def purge(queue_name)
|
181
|
+
sqs.purge_queue(queue_url: find_queue_url(queue_name))
|
182
|
+
|
183
|
+
say "Purge request sent for #{queue_name}. The message deletion process takes up to 60 seconds", :yellow
|
184
|
+
end
|
178
185
|
end
|
179
186
|
end
|
180
187
|
end
|
data/bin/shoryuken
CHANGED
@@ -16,7 +16,7 @@ module Shoryuken
|
|
16
16
|
|
17
17
|
register(Shoryuken::CLI::SQS, 'sqs', 'sqs COMMAND', 'SQS commands')
|
18
18
|
|
19
|
-
desc 'start', '
|
19
|
+
desc 'start', 'Starts shoryuken'
|
20
20
|
method_option :concurrency, aliases: '-c', type: :numeric, desc: 'Processor threads to use'
|
21
21
|
method_option :daemon, aliases: '-d', type: :boolean, desc: 'Daemonize process'
|
22
22
|
method_option :queues, aliases: '-q', type: :array, desc: 'Queues to process with optional weights'
|
@@ -39,7 +39,7 @@ module Shoryuken
|
|
39
39
|
Shoryuken::Runner.instance.run(opts.freeze)
|
40
40
|
end
|
41
41
|
|
42
|
-
desc 'version', '
|
42
|
+
desc 'version', 'Prints version'
|
43
43
|
def version
|
44
44
|
say "Shoryuken #{Shoryuken::VERSION}"
|
45
45
|
end
|
data/lib/shoryuken/manager.rb
CHANGED
@@ -2,8 +2,7 @@ module Shoryuken
|
|
2
2
|
class Manager
|
3
3
|
include Util
|
4
4
|
|
5
|
-
BATCH_LIMIT
|
6
|
-
HEARTBEAT_INTERVAL = 0.1
|
5
|
+
BATCH_LIMIT = 10
|
7
6
|
|
8
7
|
def initialize(fetcher, polling_strategy)
|
9
8
|
@count = Shoryuken.options.fetch(:concurrency, 25)
|
@@ -13,22 +12,18 @@ module Shoryuken
|
|
13
12
|
@queues = Shoryuken.queues.dup.uniq
|
14
13
|
|
15
14
|
@done = Concurrent::AtomicBoolean.new(false)
|
16
|
-
@dispatching = Concurrent::AtomicBoolean.new(false)
|
17
15
|
|
18
16
|
@fetcher = fetcher
|
19
17
|
@polling_strategy = polling_strategy
|
20
18
|
|
21
|
-
@heartbeat = Concurrent::TimerTask.new(run_now: true,
|
22
|
-
execution_interval: HEARTBEAT_INTERVAL,
|
23
|
-
timeout_interval: 60) { dispatch }
|
24
|
-
|
25
19
|
@pool = Concurrent::FixedThreadPool.new(@count, max_queue: @count)
|
20
|
+
@dispatcher_executor = Concurrent::SingleThreadExecutor.new
|
26
21
|
end
|
27
22
|
|
28
23
|
def start
|
29
24
|
logger.info { 'Starting' }
|
30
25
|
|
31
|
-
|
26
|
+
dispatch_async
|
32
27
|
end
|
33
28
|
|
34
29
|
def stop(options = {})
|
@@ -43,7 +38,7 @@ module Shoryuken
|
|
43
38
|
|
44
39
|
logger.info { 'Shutting down workers' }
|
45
40
|
|
46
|
-
@
|
41
|
+
@dispatcher_executor.kill
|
47
42
|
|
48
43
|
if options[:shutdown]
|
49
44
|
hard_shutdown_in(options[:timeout])
|
@@ -58,18 +53,23 @@ module Shoryuken
|
|
58
53
|
|
59
54
|
private
|
60
55
|
|
61
|
-
def
|
56
|
+
def dispatch_async
|
57
|
+
@dispatcher_executor.post(&method(:dispatch_now))
|
58
|
+
end
|
59
|
+
|
60
|
+
def dispatch_now
|
62
61
|
return if @done.true?
|
63
|
-
return unless @dispatching.make_true
|
64
62
|
|
65
|
-
|
66
|
-
|
63
|
+
begin
|
64
|
+
return if ready.zero?
|
65
|
+
return unless (queue = @polling_strategy.next_queue)
|
67
66
|
|
68
|
-
|
67
|
+
logger.debug { "Ready: #{ready}, Busy: #{busy}, Active Queues: #{@polling_strategy.active_queues}" }
|
69
68
|
|
70
|
-
|
71
|
-
|
72
|
-
|
69
|
+
batched_queue?(queue) ? dispatch_batch(queue) : dispatch_single_messages(queue)
|
70
|
+
ensure
|
71
|
+
dispatch_async
|
72
|
+
end
|
73
73
|
end
|
74
74
|
|
75
75
|
def busy
|
data/lib/shoryuken/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shoryuken
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pablo Cantero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|