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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04bfc0455b6d3432e76d99375ae6f13a4a025d2d
4
- data.tar.gz: 62f8cd7d1a8987845e7ac16830c2ef2d8ae1aeac
3
+ metadata.gz: 20ad5d661bdeeeb79174cae5b5f0dac0a0ce5bb6
4
+ data.tar.gz: 974fb9b07b6f3037fd73097f538d29affd07aca5
5
5
  SHA512:
6
- metadata.gz: f0fff3ec264805f7308d72d0ec04482b68b389a180e07bc5d2e18d2ac5a32659808499f6a67504b3839220d03b59bcad3f24a137c979dd54129553f1ee1ccafb
7
- data.tar.gz: 72b263ce13cec59bceaeac920c9218109a5b58f4a2b8e5bfa74e4345fc565793ec71c868486a6fabbfad5ab8ad1f1a6c91cf5f506c58523013a159f778096fc2
6
+ metadata.gz: d1a6ca116b974df3f319592fa615d7fd25beaf9d057e7ffea7287581640d47d0101edaf0ac58c5a5c092f07c76da8b056acb480231a07a7487116d9c74c3dbbb
7
+ data.tar.gz: d51cebffc15cc5db796c5d8b4a553f29be9035a8278843798b7b97af8b5e44949af6420d2d1712c6c349433043697775451eb6211e9f8cf719bcf18c1f82efd6
@@ -1,5 +1,5 @@
1
1
  module Aws
2
2
  module Xray
3
- VERSION = '0.19.0.beta2'
3
+ VERSION = '0.19.0.beta3'
4
4
  end
5
5
  end
@@ -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
- @queue.push(Item.new(payload, client.copy))
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
- # Call `.reset` after class definetion section.
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-xray
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0.beta2
4
+ version: 0.19.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taiki Ono