analytics-ruby 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +5 -2
- data/analytics-ruby-0.5.2.gem +0 -0
- data/lib/analytics-ruby/client.rb +14 -1
- data/lib/analytics-ruby/consumer.rb +2 -1
- data/lib/analytics-ruby/version.rb +1 -1
- metadata +3 -2
data/History.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
0.5.3 / 2013-12-31
|
2
|
+
==================
|
3
|
+
* Allow the consumer thread to shut down so it won't remain live in hot deploy scenarios. This fixes the jruby memory leak by [@nirvdrum](https://github.com/nirvdrum)
|
4
|
+
|
1
5
|
0.5.2 / 2013-12-02
|
2
6
|
==================
|
3
7
|
* adding `sleep` backoff between connection retries
|
@@ -8,8 +12,7 @@
|
|
8
12
|
|
9
13
|
0.5.0 / 2013-10-03
|
10
14
|
==================
|
11
|
-
|
12
|
-
* Removing global Analytics alias in favor of adding it to our config
|
15
|
+
* Removing global Analytics alias in favor of adding it to our config. NOTE: If you are upgrading from a previous version and want to continue using the `Analytics` namespace, you'll have to add `Analytics = AnalyticsRuby` to your config. See the [setup docs for more info](https://segment.io/libraries/ruby)
|
13
16
|
|
14
17
|
0.4.0 / 2013-08-30
|
15
18
|
==================
|
Binary file
|
@@ -10,6 +10,10 @@ module AnalyticsRuby
|
|
10
10
|
|
11
11
|
class Client
|
12
12
|
|
13
|
+
# Sub-class thread so we have a named thread (useful for debugging in Thread.list).
|
14
|
+
class ConsumerThread < Thread
|
15
|
+
end
|
16
|
+
|
13
17
|
# public: Creates a new client
|
14
18
|
#
|
15
19
|
# options - Hash
|
@@ -27,7 +31,16 @@ module AnalyticsRuby
|
|
27
31
|
check_secret
|
28
32
|
|
29
33
|
@consumer = AnalyticsRuby::Consumer.new @queue, @secret, options
|
30
|
-
@thread =
|
34
|
+
@thread = ConsumerThread.new { @consumer.run }
|
35
|
+
|
36
|
+
at_exit do
|
37
|
+
# Let the consumer thread know it should exit.
|
38
|
+
@thread[:should_exit] = true
|
39
|
+
|
40
|
+
# Push a flag value to the consumer queue in case it's blocked waiting for a value. This will allow it
|
41
|
+
# to continue its normal chain of processing, giving it a chance to exit.
|
42
|
+
@queue << nil
|
43
|
+
end
|
31
44
|
end
|
32
45
|
|
33
46
|
# public: Synchronously waits until the consumer has flushed the queue.
|
@@ -34,7 +34,7 @@ module AnalyticsRuby
|
|
34
34
|
# public: Continuously runs the loop to check for new events
|
35
35
|
#
|
36
36
|
def run
|
37
|
-
|
37
|
+
until Thread.current[:should_exit]
|
38
38
|
flush
|
39
39
|
end
|
40
40
|
end
|
@@ -44,6 +44,7 @@ module AnalyticsRuby
|
|
44
44
|
def flush
|
45
45
|
# Block until we have something to send
|
46
46
|
item = @queue.pop
|
47
|
+
return if item.nil?
|
47
48
|
|
48
49
|
# Synchronize on additions to the current batch
|
49
50
|
@mutex.synchronize {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: analytics-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
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: 2013-12-
|
12
|
+
date: 2013-12-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -109,6 +109,7 @@ executables: []
|
|
109
109
|
extensions: []
|
110
110
|
extra_rdoc_files: []
|
111
111
|
files:
|
112
|
+
- analytics-ruby-0.5.2.gem
|
112
113
|
- analytics-ruby.gemspec
|
113
114
|
- Gemfile
|
114
115
|
- Gemfile.lock
|