dispatch-rider 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dispatch-rider.rb +0 -1
- data/lib/dispatch-rider/demultiplexer.rb +10 -12
- data/lib/dispatch-rider/subscriber.rb +6 -6
- data/lib/dispatch-rider/version.rb +1 -1
- metadata +1 -2
- data/lib/dispatch-rider/signal_tools.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f3c1d68135996d3628b82282bbed5c3675f65b6
|
4
|
+
data.tar.gz: e4ac7f3fba37caf912d6234f46c6b6d4a7ce844c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f033db5fe1c3eae2ab79a4c788d361274bf15a7ce70343377497843232a0167a744d704d2beda5016452f5911dfd82a1ff1dba4998e6f683cbb1ecb2f8e5300
|
7
|
+
data.tar.gz: 4bfc2d394353d7dbef8688000a2a2d6e752aeba7fa06e445e6e9ea176100db9044528c55856036a49547c25ea46d30e266ece6c6fa555d50a3c6d921ba1e9eb6
|
data/lib/dispatch-rider.rb
CHANGED
@@ -13,7 +13,6 @@ module DispatchRider
|
|
13
13
|
@error_handler = error_handler
|
14
14
|
@continue = true
|
15
15
|
@current_message = nil
|
16
|
-
install_term_trap
|
17
16
|
end
|
18
17
|
|
19
18
|
def start
|
@@ -28,23 +27,22 @@ module DispatchRider
|
|
28
27
|
self
|
29
28
|
end
|
30
29
|
|
31
|
-
def stop
|
30
|
+
def stop(reason: nil)
|
32
31
|
@continue = false
|
32
|
+
if @current_message
|
33
|
+
logger.info "Got stop #{reason ? '(' + reason + ') ' : ' ' }while executing: #{message_info_fragment(@current_message)}"
|
34
|
+
end
|
33
35
|
end
|
34
36
|
|
35
37
|
private
|
36
38
|
|
37
|
-
def install_term_trap
|
38
|
-
SignalTools.append_trap('TERM') do
|
39
|
-
logger.info "Got SIGTERM while executing: #{message_info_fragment(@current_message)}" if @current_message
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
39
|
def with_current_message(message)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
40
|
+
begin
|
41
|
+
@current_message = message
|
42
|
+
yield
|
43
|
+
ensure
|
44
|
+
@current_message = nil
|
45
|
+
end
|
48
46
|
end
|
49
47
|
|
50
48
|
# This needs to return true/false based on the success of the jobs!
|
@@ -40,30 +40,30 @@ module DispatchRider
|
|
40
40
|
private
|
41
41
|
|
42
42
|
def register_quit_trap
|
43
|
-
|
43
|
+
Signal.trap("QUIT") do
|
44
44
|
# signal number: 3
|
45
45
|
logger.info "Received SIGQUIT, stopping demultiplexer"
|
46
|
-
demultiplexer.stop
|
46
|
+
demultiplexer.stop("Got SIGQUIT")
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
def register_term_trap
|
51
|
-
|
51
|
+
Signal.trap("TERM") do
|
52
52
|
# signal number: 15
|
53
53
|
logger.info "Received SIGTERM, stopping demultiplexer"
|
54
|
-
demultiplexer.stop
|
54
|
+
demultiplexer.stop("Got SIGTERM")
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
def register_int_trap
|
59
59
|
@already_interrupted = false
|
60
|
-
|
60
|
+
Signal.trap("INT") do
|
61
61
|
if @already_interrupted
|
62
62
|
logger.info "Received SIGINT second time, aborting"
|
63
63
|
exit(0)
|
64
64
|
else
|
65
65
|
logger.info "Received SIGINT first time, stopping demultiplexer"
|
66
|
-
demultiplexer.stop
|
66
|
+
demultiplexer.stop("Got SIGINT")
|
67
67
|
end
|
68
68
|
@already_interrupted = true
|
69
69
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dispatch-rider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Suman Mukherjee
|
@@ -203,7 +203,6 @@ files:
|
|
203
203
|
- lib/dispatch-rider/registrars/queue_service.rb
|
204
204
|
- lib/dispatch-rider/registrars/sns_channel.rb
|
205
205
|
- lib/dispatch-rider/runner.rb
|
206
|
-
- lib/dispatch-rider/signal_tools.rb
|
207
206
|
- lib/dispatch-rider/subscriber.rb
|
208
207
|
- lib/dispatch-rider/version.rb
|
209
208
|
- lib/generators/dispatch_rider/install/USAGE
|