event_tracer 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/event_tracer/buffer.rb +9 -2
- data/lib/event_tracer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc787e6f2e531d8525792eec4d55f3576f7b6543e356319fce7c065c436385d6
|
4
|
+
data.tar.gz: 22172cf85886ee0b668820d55bd13346997cd648b542337cc982c91510f01f50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2afa747344e9e07aa85fa1d22a6612fca83df74e2bcfeb384b4f91e742e2d4a545c1070ceb9006592dff7bc97fefefe40ed4f326002f7f76119be24e9e26287
|
7
|
+
data.tar.gz: c176243abadde0675d267138476b2dbe9cbe20f78a3d49a479c96e9a086abb83ff4df859da65029aadb115d7d42a83fddf630de32ed797e7f7c8d930dec05fcf
|
data/lib/event_tracer/buffer.rb
CHANGED
@@ -58,8 +58,15 @@ module EventTracer
|
|
58
58
|
attr_reader :buffer_size, :flush_interval, :buffer
|
59
59
|
|
60
60
|
def add_item?
|
61
|
-
buffer.size
|
62
|
-
|
61
|
+
return false if buffer.size >= buffer_size
|
62
|
+
|
63
|
+
# NOTE: we cannot use buffer.empty? then buffer.first here
|
64
|
+
# due to race-condition when another thread flushes the buffer
|
65
|
+
# right after buffer.empty? but before buffer.first is called.
|
66
|
+
# If we have more complicated use case, we may need to start introducing
|
67
|
+
# mutext.
|
68
|
+
first_item = buffer.first
|
69
|
+
first_item.nil? || first_item[:created_at] > Time.now - flush_interval
|
63
70
|
end
|
64
71
|
end
|
65
72
|
end
|
data/lib/event_tracer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event_tracer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- melvrickgoh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|