eventboss 1.0.6 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +8 -8
- data/lib/eventboss/launcher.rb +1 -0
- data/lib/eventboss/runner.rb +33 -9
- data/lib/eventboss/version.rb +1 -1
- data/lib/eventboss.rb +0 -4
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcfcef49dffcc6459e8138b6b2aa2c29ebbf78e9fb186b747c2e56a92750d0d1
|
4
|
+
data.tar.gz: faba8a61381425fd43c9314aa863f937b1c9746b6ff5104a24c3c2a260b0aab6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e962c91d54e9156459fe98b1250b92c2d9394c1b64c002960f8b3b21f17c3789f157238fc6bd4bec23646c1f5ef84626fc2ecbb5a3dd5d14e6a45ca77f90f99
|
7
|
+
data.tar.gz: 4a92c6de07b5d1509b97d2f2a73730cd35e298a903ab36baad6c115b57d03ea4e02e121b345f933bead9d8954bd6ba8b5501f40b921e662ba18aba9331225932
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [1.1.0] - 2019-07-16
|
8
|
+
|
9
|
+
### Added
|
10
|
+
- Support for handling `SIGTERM` signal gracefully. Docker containers within Kubernetes can be terminated any time (the signal is sent to containers in a pod).
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
eventboss (1.0
|
4
|
+
eventboss (1.1.0)
|
5
5
|
aws-sdk-sns (>= 1.1.0)
|
6
6
|
aws-sdk-sqs (>= 1.3.0)
|
7
7
|
concurrent-ruby (~> 1.0, >= 1.0.5)
|
@@ -11,23 +11,23 @@ GEM
|
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
13
|
aws-eventstream (1.0.3)
|
14
|
-
aws-partitions (1.
|
15
|
-
aws-sdk-core (3.
|
14
|
+
aws-partitions (1.189.0)
|
15
|
+
aws-sdk-core (3.59.0)
|
16
16
|
aws-eventstream (~> 1.0, >= 1.0.2)
|
17
17
|
aws-partitions (~> 1.0)
|
18
18
|
aws-sigv4 (~> 1.1)
|
19
19
|
jmespath (~> 1.0)
|
20
|
-
aws-sdk-sns (1.
|
21
|
-
aws-sdk-core (~> 3, >= 3.
|
20
|
+
aws-sdk-sns (1.18.0)
|
21
|
+
aws-sdk-core (~> 3, >= 3.58.0)
|
22
22
|
aws-sigv4 (~> 1.1)
|
23
|
-
aws-sdk-sqs (1.
|
24
|
-
aws-sdk-core (~> 3, >= 3.
|
23
|
+
aws-sdk-sqs (1.18.0)
|
24
|
+
aws-sdk-core (~> 3, >= 3.58.0)
|
25
25
|
aws-sigv4 (~> 1.1)
|
26
26
|
aws-sigv4 (1.1.0)
|
27
27
|
aws-eventstream (~> 1.0, >= 1.0.2)
|
28
28
|
concurrent-ruby (1.1.5)
|
29
29
|
diff-lcs (1.3)
|
30
|
-
dotenv (2.7.
|
30
|
+
dotenv (2.7.4)
|
31
31
|
jmespath (1.4.0)
|
32
32
|
rake (12.3.1)
|
33
33
|
rspec (3.7.0)
|
data/lib/eventboss/launcher.rb
CHANGED
data/lib/eventboss/runner.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Eventboss
|
2
2
|
class Runner
|
3
|
+
extend Logging
|
4
|
+
|
3
5
|
class << self
|
4
6
|
def launch
|
5
7
|
queues = Eventboss::QueueListener.list
|
@@ -10,12 +12,11 @@ module Eventboss
|
|
10
12
|
|
11
13
|
launcher = Launcher.new(queues, client, worker_count: config.concurrency)
|
12
14
|
|
13
|
-
self_read
|
15
|
+
self_read = setup_signals([:SIGTERM])
|
16
|
+
|
14
17
|
begin
|
15
18
|
launcher.start
|
16
|
-
|
17
|
-
# handle_signal(readable_io.first[0].gets.strip)
|
18
|
-
end
|
19
|
+
handle_signals(self_read, launcher)
|
19
20
|
rescue Interrupt
|
20
21
|
launcher.stop
|
21
22
|
exit 0
|
@@ -43,18 +44,41 @@ module Eventboss
|
|
43
44
|
|
44
45
|
manager.start
|
45
46
|
|
46
|
-
self_read
|
47
|
+
self_read = setup_signals([:SIGTERM])
|
48
|
+
|
47
49
|
begin
|
48
|
-
|
49
|
-
signal = readable_io.first[0].gets.strip
|
50
|
-
# handle_signal(signal)
|
51
|
-
end
|
50
|
+
handle_signals(self_read)
|
52
51
|
rescue Interrupt
|
53
52
|
executor.shutdown
|
54
53
|
executor.wait_for_termination
|
55
54
|
exit 0
|
56
55
|
end
|
57
56
|
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def setup_signals(signals)
|
61
|
+
self_read, self_write = IO.pipe
|
62
|
+
|
63
|
+
signals.each do |signal|
|
64
|
+
trap signal do
|
65
|
+
self_write.puts signal
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
self_read
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
def handle_signals(self_read, launcher)
|
74
|
+
while readable_io = IO.select([self_read])
|
75
|
+
signal = readable_io.first[0].gets.strip
|
76
|
+
logger.info("Received #{ signal } signal, gracefully shutdowning...", 'runner')
|
77
|
+
|
78
|
+
launcher.stop
|
79
|
+
exit 0
|
80
|
+
end
|
81
|
+
end
|
58
82
|
end
|
59
83
|
end
|
60
84
|
end
|
data/lib/eventboss/version.rb
CHANGED
data/lib/eventboss.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventboss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AirHelp
|
@@ -130,6 +130,7 @@ extra_rdoc_files: []
|
|
130
130
|
files:
|
131
131
|
- ".gitignore"
|
132
132
|
- ".rspec"
|
133
|
+
- CHANGELOG.md
|
133
134
|
- Gemfile
|
134
135
|
- Gemfile.lock
|
135
136
|
- Guardfile
|