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 +4 -4
- data/lib/eventq_aws/aws_queue_worker.rb +37 -2
- data/lib/eventq_aws/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df83c4b69cb3c7bf4a9641fab48ccb2875dea825
|
4
|
+
data.tar.gz: 0452fbdb0aaffabd78f9aed8555145dfcf203404
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
|
data/lib/eventq_aws/version.rb
CHANGED