eventq_aws 1.1.0 → 1.2.0

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: f2d9d12f0bca0d14f29c7b7795653f916ff01ac9
4
- data.tar.gz: 43ecb46906fba3d1a45c2ce6d277628ebc26a445
3
+ metadata.gz: df83c4b69cb3c7bf4a9641fab48ccb2875dea825
4
+ data.tar.gz: 0452fbdb0aaffabd78f9aed8555145dfcf203404
5
5
  SHA512:
6
- metadata.gz: 4b7db38f22cea735be7670a0ab919e072fe1e5bf965690f1b038240e5d980605878424223fe34565af08a9dea0b2fca31a3f08daf2e073639cac790c651b55b8
7
- data.tar.gz: 75d443ac2d52feec4f1c184ad6ad32a731e2c9893c202e7c0fdbd7505ea07d1a0ab46f34072fbf7259a47ae3640c7e1f6ad5ab72a5831d90bfa5c2ea2e3aa4ad
6
+ metadata.gz: ec41e1eb17dc17cfb8434f8a8b16eca633422874307787c325b54b864bb59aff67f292f30fc617ae6dc60c1b63e0395e0e8b42d0a021c74881b9119e98854f63
7
+ data.tar.gz: 4ce3bf7e121140589495aa59e15a661a3f6a3a76a3f28a2bcbbeac5d304a61d0c17db2121570f60ee3db8d948e7634f3443f8607faea5ce30b752e4f626fe3b6
@@ -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
@@ -28,6 +29,36 @@ module EventQ
28
29
 
29
30
  EventQ.log(:info, "[#{self.class}] - Listening for messages.")
30
31
 
32
+ @forks = []
33
+
34
+ if @fork_count > 1
35
+ @fork_count.times do
36
+ pid = fork do
37
+ start_process(options, queue, block)
38
+ end
39
+ @forks.push(pid)
40
+ end
41
+
42
+ if options.key?(:wait) && options[:wait] == true
43
+ @forks.each { |pid| Process.wait(pid) }
44
+ end
45
+
46
+ else
47
+ start_process(options, queue, block)
48
+ end
49
+
50
+ return true
51
+ end
52
+
53
+ def start_process(options, queue, block)
54
+
55
+ %w'INT TERM'.each do |sig|
56
+ Signal.trap(sig) {
57
+ stop
58
+ exit
59
+ }
60
+ end
61
+
31
62
  @is_running = true
32
63
  @threads = []
33
64
 
@@ -128,7 +159,6 @@ module EventQ
128
159
  @threads.each { |thr| thr.join }
129
160
  end
130
161
 
131
- return true
132
162
  end
133
163
 
134
164
  def stop
@@ -218,7 +248,12 @@ module EventQ
218
248
  @sleep = options[:sleep]
219
249
  end
220
250
 
221
- EventQ.log(:info, "[#{self.class}] - Configuring. Thread Count: #{@thread_count} | Interval Sleep: #{@sleep}.")
251
+ @fork_count = 1
252
+ if options.key?(:fork_count)
253
+ @fork_count = options[:fork_count]
254
+ end
255
+
256
+ EventQ.log(:info, "[#{self.class}] - Configuring. Process Count: #{@fork_count} | Thread Count: #{@thread_count} | Interval Sleep: #{@sleep}.")
222
257
 
223
258
  return true
224
259
 
@@ -1,5 +1,5 @@
1
1
  module EventQ
2
2
  module Amazon
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventq_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaughanbrittonsage