Commit f2062ffb authored by jejacks0n's avatar jejacks0n

Provide default context key hashing strategy

- With changes in gitlab-experiment v0.6.0 this has been removed, and to
keep existing experiments running without issue, we’re providing this
less cryptic MD5 solution as the default, which we’ll work to migrate
away from over time.
parent 754a6920
...@@ -11,6 +11,7 @@ Gitlab::Experiment.configure do |config| ...@@ -11,6 +11,7 @@ Gitlab::Experiment.configure do |config|
# enable migrating into the new SHA2 strategy. # enable migrating into the new SHA2 strategy.
config.context_hash_strategy = lambda do |source, seed| config.context_hash_strategy = lambda do |source, seed|
source = source.keys + source.values if source.is_a?(Hash) source = source.keys + source.values if source.is_a?(Hash)
Digest::MD5.hexdigest(Array(source).map { |v| identify(v) }.unshift(seed).join('|')) 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 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