splitclient-rb 5.0.1.pre.rc1-java → 5.0.2-java

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: f176756b53bd301ddb1c98746e6faded243c1469
4
- data.tar.gz: dfc5498bade324ade52c956a9061c4310487e35d
3
+ metadata.gz: d5c04717975f8f3719dab2e4b66e237a3f8f680a
4
+ data.tar.gz: a8b0d913af4125b8f2bfef40bd92fa45d1e26739
5
5
  SHA512:
6
- metadata.gz: 62742afddd9d8c81cd4cd753e5ecdddb3af24a7e404e4e8b9faa8a5d139da284e0df873b1aa451190b1d9e5d1a8fb9acdb74b1ada2ae09538d43f580bff90974
7
- data.tar.gz: 8616cc41633c2638552c44f4ea456b216bef709df4fb5728f34b8dc60287c56f07286bfd4cf76292ac9ccddf6e96f1e5df6ad47ab787794159ad15f4ee9c11a5
6
+ metadata.gz: 9a9ec6fb65440f0ec31df24f3e137bbe907b76a56310f0e768b49203adf1c019e25d5949ea935b66f430ec8f412575a005d74f602b776a3a5b4c8a25d5fc0b72
7
+ data.tar.gz: c1a72c76c15d66bd08ca076407069577b4051b39bdd1466921e5a5e209481d0bfa40ab1620b5bd5ce241a931c4af92b7cdbd7fee6ae0ae9388eedb5f2934ac04
@@ -1,3 +1,6 @@
1
+ 5.0.2 (July 31st, 2018)
2
+ - Prevents the impression thread from being started if a listener is not in place
3
+
1
4
  5.0.1 (July 19th, 2018)
2
5
  - Adds stop! method to the factory for gracefully stopping the SDK.
3
6
 
@@ -366,7 +366,9 @@ transport_debug_enabled: true # used for log transport data (mostly http request
366
366
 
367
367
  ### Impression Listener
368
368
 
369
- In order to capture every single impression in your app SDK provides option called Impression Listener. It works pretty straightforward: you define a class which must have instance method called `log`, which must receive 1 argument `impression`. Let's say you have the following impression listener class:
369
+ The SDK provides an optional featured called Impression Listener, that captures every single impression in your app.
370
+
371
+ To set up an Impression Listener, define a class that implements a `log` instance method, which must receive the `impression` argument. As an example you could define your listener as follows:
370
372
 
371
373
  ```ruby
372
374
  class MyImpressionListener
@@ -376,7 +378,7 @@ class MyImpressionListener
376
378
  end
377
379
  ```
378
380
 
379
- Nothing fancy here, it just takes impression and logs it to the stdout. Now, to actually use this class you'll need to specify it in your config (i.e. initializer) like this:
381
+ Nothing fancy here, the listener just takes an impression and logs it to the stdout. Now, to actually use this class you'll need to specify it as an option in your config (i.e. initializer) like this:
380
382
 
381
383
  ```ruby
382
384
  {
data/NEWS CHANGED
@@ -1,3 +1,8 @@
1
+ 5.0.2
2
+
3
+ Turn Impression Listener into an optional SDK feature.
4
+ Prevents the impression thread from being started if a listener is not in place
5
+
1
6
  5.0.1
2
7
 
3
8
  Adding stop! method to the factory.
@@ -5,6 +5,9 @@ module SplitIoClient
5
5
  def initialize(config)
6
6
  @config = config
7
7
  @listener = config.impression_listener
8
+
9
+ return unless @listener
10
+
8
11
  @queue = Queue.new
9
12
  router_thread
10
13
 
@@ -16,12 +19,12 @@ module SplitIoClient
16
19
  end
17
20
 
18
21
  def add(impression)
19
- @queue.push(impression)
22
+ enqueue(impression)
20
23
  end
21
24
 
22
25
  def add_bulk(impressions)
23
26
  impressions[:split_names].each do |split_name|
24
- @queue.push(
27
+ enqueue(
25
28
  split_name: split_name.to_s,
26
29
  matching_key: impressions[:matching_key],
27
30
  bucketing_key: impressions[:bucketing_key],
@@ -37,6 +40,10 @@ module SplitIoClient
37
40
 
38
41
  private
39
42
 
43
+ def enqueue(impression)
44
+ @queue.push(impression) if @listener
45
+ end
46
+
40
47
  def router_thread
41
48
  @config.threads[:impression_router] = Thread.new do
42
49
  loop do
@@ -144,9 +144,8 @@ module SplitIoClient
144
144
 
145
145
  def store_impression(split_name, matching_key, bucketing_key, treatment, store_impressions, attributes)
146
146
  time = (Time.now.to_f * 1000.0).to_i
147
- route_impression(split_name, matching_key, bucketing_key, time, treatment, attributes) if @config.impression_listener && store_impressions
148
147
 
149
- return if @config.impressions_queue_size <= 0 || !store_impressions
148
+ return unless @config.impressions_queue_size > 0 && store_impressions
150
149
 
151
150
  @impressions_repository.add(split_name,
152
151
  'keyName' => matching_key,
@@ -156,6 +155,9 @@ module SplitIoClient
156
155
  'time' => time,
157
156
  'changeNumber' => treatment[:change_number]
158
157
  )
158
+
159
+ route_impression(split_name, matching_key, bucketing_key, time, treatment, attributes)
160
+
159
161
  rescue StandardError => error
160
162
  @config.log_found_exception(__method__.to_s, error)
161
163
  end
@@ -22,6 +22,7 @@ module SplitIoClient
22
22
  # @option opts [Object] :logger a logger to user for messages from the client. Defaults to stdout
23
23
  # @option opts [Boolean] :debug_enabled (false) The value for the debug flag
24
24
  # @option opts [Int] :impressions_queue_size how big the impressions queue is before dropping impressions. -1 to disable it.
25
+ # @option opts [#log] :impression_listener this object will capture all impressions and process them through `#log`
25
26
  #
26
27
  # @return [type] SplitConfig with configuration options
27
28
  def initialize(opts = {})
@@ -1,3 +1,3 @@
1
1
  module SplitIoClient
2
- VERSION = '5.0.1.pre.rc1'
2
+ VERSION = '5.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splitclient-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1.pre.rc1
4
+ version: 5.0.2
5
5
  platform: java
6
6
  authors:
7
7
  - Split Software
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-20 00:00:00.000000000 Z
11
+ date: 2018-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -309,9 +309,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
309
309
  version: '0'
310
310
  required_rubygems_version: !ruby/object:Gem::Requirement
311
311
  requirements:
312
- - - ">"
312
+ - - ">="
313
313
  - !ruby/object:Gem::Version
314
- version: 1.3.1
314
+ version: '0'
315
315
  requirements: []
316
316
  rubyforge_project:
317
317
  rubygems_version: 2.6.14