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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e028e3d9a8a8ff145fec398add51a0ba577f809a4aeeebef1f5adc7d3fc0f25
4
- data.tar.gz: 9cfdcf393c9cf7ff580dc98d04993ca3405f09881d31c5e056e69f10461a13ad
3
+ metadata.gz: bcfcef49dffcc6459e8138b6b2aa2c29ebbf78e9fb186b747c2e56a92750d0d1
4
+ data.tar.gz: faba8a61381425fd43c9314aa863f937b1c9746b6ff5104a24c3c2a260b0aab6
5
5
  SHA512:
6
- metadata.gz: 1f39affd1e01bea2db937ebcebd7d4b6e056a69f9b28bb6b99135b6bebe17cb44dd307b1ddd0e4aaa0419c96454a59c7e9720163d7b2ffa47456a284cd7dc273
7
- data.tar.gz: 45c836213a2ab8a4f54184ae5ba72403da940b35c41d894624c9d6dc4549a7abaf52194dcf142e68e6ae7a35b4b60f379405b73b7ddad6cb5eb676aafb1fb4fc
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.3)
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.167.0)
15
- aws-sdk-core (3.53.1)
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.16.0)
21
- aws-sdk-core (~> 3, >= 3.53.0)
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.16.0)
24
- aws-sdk-core (~> 3, >= 3.53.0)
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.2)
30
+ dotenv (2.7.4)
31
31
  jmespath (1.4.0)
32
32
  rake (12.3.1)
33
33
  rspec (3.7.0)
@@ -23,6 +23,7 @@ module Eventboss
23
23
 
24
24
  def start
25
25
  logger.info("Starting #{@workers.size} workers, #{@pollers.size} pollers", 'launcher')
26
+
26
27
  @pollers.each(&:start)
27
28
  @workers.each(&:start)
28
29
  end
@@ -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, _self_write = IO.pipe
15
+ self_read = setup_signals([:SIGTERM])
16
+
14
17
  begin
15
18
  launcher.start
16
- while (_readable_io = IO.select([self_read]))
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, self_write = IO.pipe
47
+ self_read = setup_signals([:SIGTERM])
48
+
47
49
  begin
48
- while (readable_io = IO.select([self_read]))
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
@@ -1,3 +1,3 @@
1
1
  module Eventboss
2
- VERSION = "1.0.6"
2
+ VERSION = "1.1.0"
3
3
  end
data/lib/eventboss.rb CHANGED
@@ -56,10 +56,6 @@ module Eventboss
56
56
  )
57
57
  end
58
58
 
59
- def listen
60
- Eventboss::Runner.start
61
- end
62
-
63
59
  def launch
64
60
  Eventboss::Runner.launch
65
61
  end
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.6
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