eventq_rabbitmq 1.6.2 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb4f7be21507b6f13d60d45e646fba56a48b9413
4
- data.tar.gz: 6070890b42376f67d1f75c0bc8b845accd0a39e5
3
+ metadata.gz: cb0a8aaadebe9b2fd3bbd557b3b4fb65e94dd4a8
4
+ data.tar.gz: bbd343360f66cf17b07673623723cbf9bae747d3
5
5
  SHA512:
6
- metadata.gz: 98f43d173483b015c3aec399f2ceb4ac02153ef9968882a22adaa57b768904eadf4cbd4a78f688362343c426d298c3a1aae524d52999649deec0d63756f3f9a4
7
- data.tar.gz: 116198501722596504454e1b7ffc2a38aee79f1af14664edc89964abb60cf9676a1a511d8b3377cbece082e346043cea8f6bb45d17d14fc8bd0d52ff70b4e384
6
+ metadata.gz: 953690b927906786332814a160c39c47557c57dd841f70c5b239e87384b7a42f696520ce223db3f14997abb2cddd92636bef933021d93a3ad8fb465610faec89
7
+ data.tar.gz: 0177d2cbd45c30dc636f245e1eddeba2e254a6e79c93f26b0a52f24ee2165abbdcd92f143eafa8151c082f1f6bcf15742fdbadddcc527ee13e25f28396eb81ac
@@ -6,6 +6,7 @@ module EventQ
6
6
 
7
7
  def initialize
8
8
  @threads = []
9
+ @forks = []
9
10
  @is_running = false
10
11
 
11
12
  @retry_exceeded_block = nil
@@ -15,15 +16,12 @@ module EventQ
15
16
 
16
17
  def start(queue, options = {}, &block)
17
18
 
18
- Signal.trap('TERM') {
19
- stop
20
- exit
21
- }
22
-
23
- Signal.trap('INT') {
24
- stop
25
- exit
26
- }
19
+ %w'INT TERM'.each do
20
+ Signal.trap('TERM') {
21
+ stop
22
+ exit
23
+ }
24
+ end
27
25
 
28
26
  EventQ.log(:info, "[#{self.class}] - Preparing to start listening for messages.")
29
27
 
@@ -38,24 +36,33 @@ module EventQ
38
36
  EventQ.log(:info, "[#{self.class}] - Listening for messages.")
39
37
 
40
38
  @forks = []
39
+
41
40
  if @fork_count > 1
42
41
  @fork_count.times do
43
42
  pid = fork do
44
- Signal.trap('TERM') {
45
- @is_running = false
43
+
44
+ %w'INT TERM'.each do
45
+ Signal.trap('TERM') {
46
+ stop
46
47
  exit
47
- }
48
+ }
49
+ end
50
+
48
51
  @is_running = true
49
52
  start_process(options, queue, block)
50
53
  end
51
54
  @forks.push(pid)
52
55
  end
56
+
57
+ if options.key?(:wait) && options[:wait] == true
58
+ @forks.each { |pid| Process.wait(pid) }
59
+ end
60
+
53
61
  else
54
62
  @is_running = true
55
63
  start_process(options, queue, block)
56
64
  end
57
65
 
58
-
59
66
  end
60
67
 
61
68
  def start_process(options, queue, block)
@@ -162,7 +169,7 @@ module EventQ
162
169
  puts "[#{self.class}] - Stopping..."
163
170
  @is_running = false
164
171
  if @forks.count > 1
165
- @forks.each { |pid| Process.kill('TERM', pid) }
172
+ @forks.each { |pid| Process.kill('INT', pid) }
166
173
  else
167
174
  @threads.each { |thr| thr.join }
168
175
  end
@@ -1,3 +1,3 @@
1
1
  module EventqRabbitmq
2
- VERSION = "1.6.2"
2
+ VERSION = "1.6.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventq_rabbitmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaughanbrittonsage