ff-ruby-server-sdk 1.4.6 → 1.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 619302fd2168c1df9c8a16375f271e31795465530b880cb51986fbc104577c47
4
- data.tar.gz: b778008b460e9db5f86382e6bd62a6bace2ee543a59fb8d4de9df80bd98ff484
3
+ metadata.gz: 0ceb06b99a2e2c3f2f6d1aa0d266287d0975e0284ee31707589240f607b894a0
4
+ data.tar.gz: 3ed9e32ef921a2e67be053769dcb2176e27728c07438199fa753a04f4be12817
5
5
  SHA512:
6
- metadata.gz: fa0fd5bece56084de57aeee050e8dd1ed890981fb868ee50bd44f2219ce3a6b0ac49ffde2c6c8f63131271a57b5f4994d91446f2abfc0bd056ab66a48405c90f
7
- data.tar.gz: 4c439844d1780986454e7cf685b236715ae71c2535f7481305f81bc839055fc98691c14d214a1252e5975de7ff894fcceea879a0094ecc06e82a6358fb3ce095
6
+ metadata.gz: 3d45cf7ef2677ccedd2e612d349fef80a26cdcd020eb2cc24eb5969b4852ac5b8023216753dae778eb38657ab7801c25c5393cbc636d5c35b457a101969129c2
7
+ data.tar.gz: 8c9455611a21ba09fa95e09617461ee49f63a844b51f646e30d1d339fb6843afa8fcbed54e87a7bc84fbe86679969cbdc842d85461a204b6ed5a54cf9a435abf
@@ -96,11 +96,12 @@ client.init(apiKey, ConfigBuilder.new.logger(logger).build)
96
96
 
97
97
  The Public API exposes a few methods that you can utilize:
98
98
 
99
- Instantiate, initialize and close when done:
99
+ Instantiate, initialize, check if initialized and close when done:
100
100
 
101
101
  * `def initialize(api_key = nil, config = nil, connector = nil)`
102
+ * `def initialized`
102
103
  * `def init(api_key = nil, config = nil, connector = nil)`
103
- * `def wait_for_initialization`
104
+ * `def wait_for_initialization(timeout: nil)`
104
105
  * `def close`
105
106
 
106
107
  Evaluations:
@@ -24,8 +24,10 @@ client = CfClient.instance
24
24
  client.init(apiKey, ConfigBuilder.new.logger(logger).build)
25
25
 
26
26
  logger.info "----- initialization started ----- "
27
+ logger.info "initialised: #{client.initialized}"
27
28
  client.wait_for_initialization
28
29
  logger.info "----- initialization done ----- "
30
+ logger.info "initialised: #{client.initialized}"
29
31
 
30
32
  # Create a target (different targets can get different results based on rules. This include a custom attribute 'location')
31
33
  target = Target.new("RubySDK", identifier="rubysdk", attributes={"location": "emea"})
@@ -44,13 +44,12 @@ class MetricsProcessor < Closeable
44
44
  @metric_maps_mutex = Mutex.new
45
45
  @evaluation_metrics = {}
46
46
  @target_metrics = {}
47
+ @target_metrics_max_payload = 1000
47
48
 
48
49
  # Keep track of targets that have already been sent to avoid sending them again. We track a max 500K targets
49
50
  # to prevent unbounded growth.
50
51
  @seen_targets_mutex = Mutex.new
51
52
  @seen_targets = Set.new
52
- @max_seen_targets = 500000
53
- @seen_targets_full = false
54
53
 
55
54
  # Mutex to protect aggregation and sending metrics at the end of an interval
56
55
  @send_data_mutex = Mutex.new
@@ -110,22 +109,30 @@ class MetricsProcessor < Closeable
110
109
  return if target.is_private
111
110
 
112
111
  add_to_target_metrics = @seen_targets_mutex.synchronize do
113
- # If the set is full, directly allow adding to target_metrics
114
- if @seen_targets_full
115
- true
116
- elsif @seen_targets.include?(target.identifier)
112
+ if @seen_targets.include?(target.identifier)
117
113
  false
118
114
  else
119
115
  @seen_targets.add(target.identifier)
120
- @seen_targets_full = @seen_targets.size >= @max_seen_targets
121
116
  true
122
117
  end
123
118
  end
124
119
 
125
120
  # Add to target_metrics if marked for inclusion
126
- @metric_maps_mutex.synchronize do
127
- @target_metrics[target.identifier] = target
121
+ dropped = @metric_maps_mutex.synchronize do
122
+ if @target_metrics.size < @target_metrics_max_payload
123
+ @target_metrics[target.identifier] = target
124
+ false
125
+ else
126
+ true
127
+ end
128
128
  end if add_to_target_metrics
129
+
130
+ # If we had to drop the target, remove it from the seen list too, assume it will be readded later
131
+ # avoids a situation where targets were marked seen but never really sent
132
+ @seen_targets_mutex.synchronize do
133
+ @seen_targets.delete(target.identifier)
134
+ end if dropped
135
+
129
136
  end
130
137
 
131
138
 
@@ -5,7 +5,7 @@ module Ff
5
5
  module Server
6
6
  module Sdk
7
7
 
8
- VERSION = "1.4.6"
8
+ VERSION = "1.4.7"
9
9
  end
10
10
  end
11
11
  end
data/scripts/sdk_specs.sh CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/bin/bash
2
2
 
3
3
  export ff_ruby_sdk="ff-ruby-server-sdk"
4
- export ff_ruby_sdk_version="1.4.6"
4
+ export ff_ruby_sdk_version="1.4.7"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ff-ruby-server-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.6
4
+ version: 1.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - 'Miloš Vasić, cyr.: Милош Васић'
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-20 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rake
@@ -302,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
302
302
  - !ruby/object:Gem::Version
303
303
  version: '0'
304
304
  requirements: []
305
- rubygems_version: 3.6.2
305
+ rubygems_version: 3.6.9
306
306
  specification_version: 4
307
307
  summary: Harness is a feature management platform that helps teams to build better
308
308
  software and to test features quicker.