File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
main/java/com/featureprobe/sdk/server/model
test/groovy/com/featureprobe/sdk/server Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ public Split(List<List<List<Integer>>> distribution) {
36
36
37
37
public HitResult findIndex (FPUser user , String toggleKey ) {
38
38
String hashKey = user .getKey () != null ? user .getKey () : String .valueOf (System .nanoTime ());
39
+ user .stableRollout (hashKey );
39
40
if (StringUtils .isNotBlank (bucketBy )) {
40
41
if (user .containAttr (bucketBy )) {
41
42
hashKey = user .getAttr (bucketBy );
Original file line number Diff line number Diff line change @@ -27,5 +27,16 @@ class SplitSpec extends Specification {
27
27
}
28
28
}
29
29
30
+ def " User not has key" () {
31
+ when :
32
+ user = new FPUser ()
33
+ def result1 = split. findIndex(user, " test_toggle_key" )
34
+ def key1 = user. key
35
+ def result2 = split. findIndex(user, " test_toggle_key" )
36
+ def key2 = user. key
37
+ then :
38
+ key1 == key2
39
+ result1. index. get() == result2. index. get()
40
+ }
30
41
31
42
}
You can’t perform that action at this time.
0 commit comments