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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b70c4e9b2ce484be153313962db7afd1f68155f2
4
- data.tar.gz: 44dcf95f87b6bf897295a778f78eb0c339e08bed
3
+ metadata.gz: a5b9f398fbabcdd1cfcd040fb70aa64d3a3d1f90
4
+ data.tar.gz: 5fe9cd8ef0e0cce01d771f5b51d2027272448566
5
5
  SHA512:
6
- metadata.gz: c5d5f1fab0a8d50e3efd438873aa8856998859f92327bfa0283c914868cdcbe30493a0a92255e1da523ebedc7c971722cf6a01358c1c60aaa7be187ced7e335d
7
- data.tar.gz: 0b32ae7eccb733990f2e5fdae338da4db98aaca575c6e13a92e4b338a47970800147a535bcb916d29a6645bfece537a16d3a8d8ca60fe0a5481a7f7ede5b09a5
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.
@@ -1,3 +1,3 @@
1
1
  module Skyrunner
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
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: 15) do |message|
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skyrunner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Fodor