aws-xray 0.19.0.beta2 → 0.19.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws/xray/version.rb +1 -1
- data/lib/aws/xray/worker.rb +15 -2
- 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: 20ad5d661bdeeeb79174cae5b5f0dac0a0ce5bb6
|
4
|
+
data.tar.gz: 974fb9b07b6f3037fd73097f538d29affd07aca5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1a6ca116b974df3f319592fa615d7fd25beaf9d057e7ffea7287581640d47d0101edaf0ac58c5a5c092f07c76da8b056acb480231a07a7487116d9c74c3dbbb
|
7
|
+
data.tar.gz: d51cebffc15cc5db796c5d8b4a553f29be9035a8278843798b7b97af8b5e44949af6420d2d1712c6c349433043697775451eb6211e9f8cf719bcf18c1f82efd6
|
data/lib/aws/xray/version.rb
CHANGED
data/lib/aws/xray/worker.rb
CHANGED
@@ -13,12 +13,17 @@ module Aws
|
|
13
13
|
class Item < Struct.new(:payload, :client)
|
14
14
|
end
|
15
15
|
|
16
|
+
@post_lock = ::Mutex.new
|
17
|
+
@pid = $$
|
16
18
|
class << self
|
17
19
|
# @param [String] payload to send
|
18
20
|
# @param [Aws::Xray::Client] client
|
19
21
|
def post(payload, client)
|
20
22
|
Aws::Xray.config.logger.debug("#{Thread.current}: Worker.post received a job")
|
21
|
-
@
|
23
|
+
@post_lock.synchronize do
|
24
|
+
refresh_if_forked
|
25
|
+
@queue.push(Item.new(payload, client.copy))
|
26
|
+
end
|
22
27
|
Aws::Xray.config.logger.debug("#{Thread.current}: Worker.post pushed a job")
|
23
28
|
rescue ThreadError => e
|
24
29
|
raise QueueIsFullError.new(e)
|
@@ -30,7 +35,15 @@ module Aws
|
|
30
35
|
@workers.each(&:kill) if defined?(@workers) && !@workers.empty?
|
31
36
|
@workers = Array.new(config.num) { new(@queue).run }
|
32
37
|
end
|
33
|
-
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def refresh_if_forked
|
42
|
+
if @pid != $$
|
43
|
+
reset(Aws::Xray.config.worker)
|
44
|
+
@pid = $$
|
45
|
+
end
|
46
|
+
end
|
34
47
|
end
|
35
48
|
|
36
49
|
def initialize(queue)
|