determinator 2.9.1 → 2.9.3
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 +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile +2 -0
- data/lib/determinator/actor_control.rb +6 -4
- data/lib/determinator/cache/fetch_wrapper.rb +16 -4
- data/lib/determinator/feature.rb +2 -2
- data/lib/determinator/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '009b70756437db9c6dc88091752e870588fe171bc729d7ec16cfcddb8e8033e2'
|
|
4
|
+
data.tar.gz: ac042540a864bc4af7fffd016b4e0d6a94243e1c764d6770c71b818a516d77fc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c1a7f55c7e672d7e647b23ed79ba84af1fdeeb761460d8126742564d395ad541b53cd050c1bbf232933ddfca3f8eb9b6124c21d3f661c7b1cc37d1ba8d383c42
|
|
7
|
+
data.tar.gz: 9a70fe0809c9309cb330571fef09511debcbf951d9cf73ab2eae8ec22001adc4eaba3f8d684b1ed7e8943454c350196471914e9d10d20781b4c647616d6ba918
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# 2.9.3
|
|
2
|
+
|
|
3
|
+
Feature:
|
|
4
|
+
- Add optional `feature` argument to `feature_flag_on?` and `which_variant` methods of ActorControl, to reuse an existing feature.
|
|
5
|
+
- Add mutex to synchronise access to caches in Cache::FetchWrapper.
|
|
6
|
+
|
|
7
|
+
# 2.9.2
|
|
8
|
+
|
|
9
|
+
Bug fix:
|
|
10
|
+
- Fix parsing fixed determinations when the variant is an empty string
|
|
11
|
+
|
|
1
12
|
# 2.9.1
|
|
2
13
|
|
|
3
14
|
Feature:
|
data/Gemfile
CHANGED
|
@@ -14,22 +14,24 @@ module Determinator
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
# @see Determinator::Control#which_variant
|
|
17
|
-
def which_variant(name, properties: {})
|
|
17
|
+
def which_variant(name, properties: {}, feature: nil)
|
|
18
18
|
controller.which_variant(
|
|
19
19
|
name,
|
|
20
20
|
id: id,
|
|
21
21
|
guid: guid,
|
|
22
|
-
properties: default_properties.merge(properties)
|
|
22
|
+
properties: default_properties.merge(properties),
|
|
23
|
+
feature: feature
|
|
23
24
|
)
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
# @see Determinator::Control#feature_flag_on?
|
|
27
|
-
def feature_flag_on?(name, properties: {})
|
|
28
|
+
def feature_flag_on?(name, properties: {}, feature: nil)
|
|
28
29
|
controller.feature_flag_on?(
|
|
29
30
|
name,
|
|
30
31
|
id: id,
|
|
31
32
|
guid: guid,
|
|
32
|
-
properties: default_properties.merge(properties)
|
|
33
|
+
properties: default_properties.merge(properties),
|
|
34
|
+
feature: feature
|
|
33
35
|
)
|
|
34
36
|
end
|
|
35
37
|
|
|
@@ -7,12 +7,16 @@ module Determinator
|
|
|
7
7
|
def initialize(*caches, cache_missing: true)
|
|
8
8
|
@cache_missing = cache_missing
|
|
9
9
|
@caches = caches
|
|
10
|
+
@mutex = Mutex.new
|
|
10
11
|
end
|
|
11
12
|
|
|
12
13
|
# Call walks through each cache, returning a value if the item exists in
|
|
13
14
|
# any cache, otherwise popularing each cache with the value of yield.
|
|
14
15
|
def call(feature_name)
|
|
15
|
-
value =
|
|
16
|
+
value =
|
|
17
|
+
@mutex.synchronize do
|
|
18
|
+
read_and_upfill(feature_name)
|
|
19
|
+
end
|
|
16
20
|
|
|
17
21
|
# if the value is missing and we cache it, return the missing response
|
|
18
22
|
return value if value.is_a?(MissingResponse) && @cache_missing
|
|
@@ -22,14 +26,20 @@ module Determinator
|
|
|
22
26
|
|
|
23
27
|
value_to_write = yield
|
|
24
28
|
return value_to_write if value_to_write.is_a?(ErrorResponse)
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
|
|
30
|
+
@mutex.synchronize do
|
|
31
|
+
@caches.each do |cache|
|
|
32
|
+
cache.write(key(feature_name), value_to_write)
|
|
33
|
+
end
|
|
27
34
|
end
|
|
35
|
+
|
|
28
36
|
return value_to_write
|
|
29
37
|
end
|
|
30
38
|
|
|
31
39
|
def expire(feature_name)
|
|
32
|
-
@
|
|
40
|
+
@mutex.synchronize do
|
|
41
|
+
@caches.each{ |c| c.delete(key(feature_name)) }
|
|
42
|
+
end
|
|
33
43
|
end
|
|
34
44
|
|
|
35
45
|
private
|
|
@@ -52,9 +62,11 @@ module Determinator
|
|
|
52
62
|
@caches[0...index].each do |cache|
|
|
53
63
|
cache.write(key(feature_name), value)
|
|
54
64
|
end
|
|
65
|
+
|
|
55
66
|
return value
|
|
56
67
|
end
|
|
57
68
|
end
|
|
69
|
+
|
|
58
70
|
return nil
|
|
59
71
|
end
|
|
60
72
|
end
|
data/lib/determinator/feature.rb
CHANGED
|
@@ -100,10 +100,10 @@ module Determinator
|
|
|
100
100
|
return fixed_determination if fixed_determination.is_a? FixedDetermination
|
|
101
101
|
|
|
102
102
|
variant = fixed_determination['variant']
|
|
103
|
-
return nil if variant && !variants.keys.include?(variant)
|
|
103
|
+
return nil if variant.present? && !variants.keys.include?(variant)
|
|
104
104
|
|
|
105
105
|
# if a variant is present the fixed determination should always be on
|
|
106
|
-
return nil if variant && !fixed_determination['feature_on']
|
|
106
|
+
return nil if variant.present? && !fixed_determination['feature_on']
|
|
107
107
|
|
|
108
108
|
constraints = fixed_determination['constraints'].to_h
|
|
109
109
|
|
data/lib/determinator/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: determinator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.9.
|
|
4
|
+
version: 2.9.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- JP Hastings-Spital
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-02-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
251
251
|
- !ruby/object:Gem::Version
|
|
252
252
|
version: '0'
|
|
253
253
|
requirements: []
|
|
254
|
-
rubygems_version: 3.
|
|
254
|
+
rubygems_version: 3.1.6
|
|
255
255
|
signing_key:
|
|
256
256
|
specification_version: 4
|
|
257
257
|
summary: Determine which experiments and features a specific actor should see.
|