diff --git a/lib/ff/ruby/server/sdk/api/evaluator.rb b/lib/ff/ruby/server/sdk/api/evaluator.rb index 1f0479f..3622be2 100644 --- a/lib/ff/ruby/server/sdk/api/evaluator.rb +++ b/lib/ff/ruby/server/sdk/api/evaluator.rb @@ -311,7 +311,6 @@ def is_target_included_or_excluded_in_segment(segment_list, target) if new_serving_rules != nil && !new_serving_rules.empty? # Use enhanced rules first if they're available - new_serving_rules.sort_by!(&:priority) new_serving_rules.each do |serving_rule| if evaluate_clauses_v2(serving_rule.clauses, target) return true @@ -339,11 +338,7 @@ def evaluate_rules(serving_rules, target) return nil end - sorted = serving_rules.sort do |a, b| - b.priority <=> a.priority - end - - sorted.each do |rule| + serving_rules.each do |rule| next unless evaluate_rule(rule, target) if rule.serve.distribution != nil diff --git a/lib/ff/ruby/server/sdk/api/storage_repository.rb b/lib/ff/ruby/server/sdk/api/storage_repository.rb index c61f36b..af25f7e 100644 --- a/lib/ff/ruby/server/sdk/api/storage_repository.rb +++ b/lib/ff/ruby/server/sdk/api/storage_repository.rb @@ -107,6 +107,7 @@ def set_flag(identifier, feature_config) return end + sort_flag_rules(feature_config) flag_key = format_flag_key(identifier) if @store != nil @@ -141,6 +142,7 @@ def set_segment(identifier, segment) return end + sort_segment_serving_rules(segment) segment_key = format_segment_key(identifier) if @store != nil @@ -240,6 +242,18 @@ def is_flag_outdated(identifier, new_feature_config) false end + def sort_flag_rules(flag) + if flag.rules && flag.rules.length > 1 + flag.rules.sort_by!(&:priority) + end + end + + def sort_segment_serving_rules(segment) + if segment.serving_rules && segment.serving_rules.length > 1 + segment.serving_rules.sort_by!(&:priority) + end + end + def is_segment_outdated(identifier, new_segment) segment = get_segment(identifier, false) diff --git a/lib/ff/ruby/server/sdk/version.rb b/lib/ff/ruby/server/sdk/version.rb index a0ddad7..6c2c857 100644 --- a/lib/ff/ruby/server/sdk/version.rb +++ b/lib/ff/ruby/server/sdk/version.rb @@ -5,7 +5,7 @@ module Ruby module Server module Sdk - VERSION = "1.3.0" + VERSION = "1.3.1" end end end diff --git a/scripts/sdk_specs.sh b/scripts/sdk_specs.sh index 72aaf2d..488db41 100755 --- a/scripts/sdk_specs.sh +++ b/scripts/sdk_specs.sh @@ -1,4 +1,4 @@ #!/bin/bash export ff_ruby_sdk="ff-ruby-server-sdk" -export ff_ruby_sdk_version="1.3.0" +export ff_ruby_sdk_version="1.3.1"