Commit b2ecff35 authored by Kerri Miller's avatar Kerri Miller

Merge branch 'jejacks0n/provide-default-context-key-strategy' into 'master'

Provide default context key hashing strategy

See merge request gitlab-org/gitlab!62414
parents 75e596fe f2062ffb
...@@ -5,4 +5,13 @@ Gitlab::Experiment.configure do |config| ...@@ -5,4 +5,13 @@ Gitlab::Experiment.configure do |config|
config.cache = Gitlab::Experiment::Cache::RedisHashStore.new( config.cache = Gitlab::Experiment::Cache::RedisHashStore.new(
pool: ->(&block) { Gitlab::Redis::SharedState.with { |redis| block.call(redis) } } pool: ->(&block) { Gitlab::Redis::SharedState.with { |redis| block.call(redis) } }
) )
# TODO: This will be deprecated as of v0.6.0, but needs to stay intact for
# actively running experiments until a versioning concept is put in place to
# enable migrating into the new SHA2 strategy.
config.context_hash_strategy = lambda do |source, seed|
source = source.keys + source.values if source.is_a?(Hash)
data = Array(source).map { |v| (v.respond_to?(:to_global_id) ? v.to_global_id : v).to_s }
Digest::MD5.hexdigest(data.unshift(seed).join('|'))
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment