skyrunner 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/generators/sky_runner/install/templates/skyrunner.rake +8 -0
- data/lib/skyrunner/version.rb +1 -1
- data/lib/skyrunner.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5b9f398fbabcdd1cfcd040fb70aa64d3a3d1f90
|
4
|
+
data.tar.gz: 5fe9cd8ef0e0cce01d771f5b51d2027272448566
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e9d668cbc228c57033d55d7d039a1484336e7f39f16723030fdd7a661229ff595c49f33341c272630a786ce7ece1abe0137b53b354808079908fd84b2df71a1
|
7
|
+
data.tar.gz: 112e3e45a72880d6d0c6537aabcbac8d6713511d0946c81bedba0f2d2183601ef34ba812e713168f4896dcbabe554e613a7113704167a1a3d215fce43700c4b4
|
data/README.md
CHANGED
@@ -31,6 +31,8 @@ To start a consumer
|
|
31
31
|
bundle exec rake skyrunner:consume
|
32
32
|
``
|
33
33
|
|
34
|
+
To shut down a consumer, send it SIGINT or SIGTERM.
|
35
|
+
|
34
36
|
See `jobs/example_job.rb` for an example job. To run a job, just call `execute!` on the job, passing any named job arguments you want. The job class should implement the method `run`. This method will get passed the job arguments. For each task you want consumers to run, `run` should yield an array of two elements, the first being the name of the method on the job class to run for the task, and the second a Hash of method arguments.
|
35
37
|
|
36
38
|
You can specify `on_complete` and `on_failure` method(s) to call when the tasks are all completed, or if any of them fail, respectively. These methods will also be passed the original job arguments. Importantly, the completion method is guaranteed to be called once and only once, when the final task has been completed.
|
@@ -6,6 +6,14 @@ namespace :skyrunner do
|
|
6
6
|
|
7
7
|
desc "Starts consuming SkyRunner tasks."
|
8
8
|
task consume: :environment do
|
9
|
+
trap("INT") do
|
10
|
+
SkyRunner.stop_consuming!
|
11
|
+
end
|
12
|
+
|
13
|
+
trap("TERM") do
|
14
|
+
SkyRunner.stop_consuming!
|
15
|
+
end
|
16
|
+
|
9
17
|
SkyRunner.consume! do |exception|
|
10
18
|
if exception
|
11
19
|
# TODO customize this with what you want to do if there is an exception.
|
data/lib/skyrunner/version.rb
CHANGED
data/lib/skyrunner.rb
CHANGED
@@ -74,7 +74,7 @@ module SkyRunner
|
|
74
74
|
|
75
75
|
received_messages = []
|
76
76
|
|
77
|
-
queue.receive_messages(limit: [1, [SkyRunner.consumer_batch_size, SQS_MAX_BATCH_SIZE].min].max, wait_time_seconds:
|
77
|
+
queue.receive_messages(limit: [1, [SkyRunner.consumer_batch_size, SQS_MAX_BATCH_SIZE].min].max, wait_time_seconds: 5) do |message|
|
78
78
|
received_messages << [message, JSON.parse(message.body)]
|
79
79
|
end
|
80
80
|
|