backburner 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -1
- data/lib/backburner/version.rb +1 -1
- data/lib/backburner/worker.rb +13 -0
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/lib/backburner/version.rb
CHANGED
data/lib/backburner/worker.rb
CHANGED
@@ -61,6 +61,7 @@ module Backburner
|
|
61
61
|
# Worker.new(['test.job'])
|
62
62
|
def initialize(tube_names=nil)
|
63
63
|
@tube_names = self.process_tube_names(tube_names)
|
64
|
+
register_signal_handlers!
|
64
65
|
end
|
65
66
|
|
66
67
|
# Starts processing ready jobs indefinitely.
|
@@ -87,6 +88,12 @@ module Backburner
|
|
87
88
|
raise NotImplementedError
|
88
89
|
end
|
89
90
|
|
91
|
+
# Triggers this worker to shutdown
|
92
|
+
def shutdown
|
93
|
+
log_info 'Worker exiting...'
|
94
|
+
Kernel.exit!
|
95
|
+
end
|
96
|
+
|
90
97
|
# Processes tube_names given tube_names array.
|
91
98
|
# Should return normalized tube_names as an array of strings.
|
92
99
|
#
|
@@ -166,5 +173,11 @@ module Backburner
|
|
166
173
|
tube_names ||= Backburner.default_queues.any? ? Backburner.default_queues : all_existing_queues
|
167
174
|
Array(tube_names)
|
168
175
|
end
|
176
|
+
|
177
|
+
# Registers signal handlers TERM and INT to trigger
|
178
|
+
def register_signal_handlers!
|
179
|
+
trap('TERM') { shutdown }
|
180
|
+
trap('INT') { shutdown }
|
181
|
+
end
|
169
182
|
end # Worker
|
170
183
|
end # Backburner
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backburner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: beaneater
|
@@ -168,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
168
|
version: '0'
|
169
169
|
segments:
|
170
170
|
- 0
|
171
|
-
hash:
|
171
|
+
hash: 336951971808813718
|
172
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
173
|
none: false
|
174
174
|
requirements:
|
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
177
|
version: '0'
|
178
178
|
segments:
|
179
179
|
- 0
|
180
|
-
hash:
|
180
|
+
hash: 336951971808813718
|
181
181
|
requirements: []
|
182
182
|
rubyforge_project:
|
183
183
|
rubygems_version: 1.8.25
|