fluent-plugin-datacounter 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "fluent-plugin-datacounter"
6
- s.version = "0.2.1"
6
+ s.version = "0.2.2"
7
7
  s.authors = ["TAGOMORI Satoshi"]
8
8
  s.email = ["tagomoris@gmail.com"]
9
9
  s.homepage = "https://github.com/tagomoris/fluent-plugin-datacounter"
@@ -69,11 +69,11 @@ class Fluent::DataCounterOutput < Fluent::Output
69
69
  end
70
70
 
71
71
  @counts = count_initialized
72
+ @mutex = Mutex.new
72
73
  end
73
74
 
74
75
  def start
75
76
  super
76
- @counts = count_initialized
77
77
  start_watch
78
78
  end
79
79
 
@@ -101,11 +101,13 @@ class Fluent::DataCounterOutput < Fluent::Output
101
101
  if @aggregate == :all
102
102
  tag = 'all'
103
103
  end
104
- @counts[tag] ||= [0] * @patterns.length
105
-
106
- counts.each_with_index do |count, i|
107
- @counts[tag][i] += count
108
- end
104
+
105
+ @mutex.synchronize {
106
+ @counts[tag] ||= [0] * @patterns.length
107
+ counts.each_with_index do |count, i|
108
+ @counts[tag][i] += count
109
+ end
110
+ }
109
111
  end
110
112
 
111
113
  def stripped_tag(tag)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-datacounter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-23 00:00:00.000000000 Z
12
+ date: 2012-03-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd