class Gitlab::Experiment::Rollout::RoundRobin

Constants

KEY_NAME

Public Instance Methods

execute() click to toggle source

Requires a cache to be configured.

Keeps track of the number of assignments into the experiment group, and uses this to rotate “round robin” style through the variants that are defined.

Relatively performant, but requires a cache, and is dependent on the performance of that cache store.

# File lib/gitlab/experiment/rollout/round_robin.rb, line 17
def execute
  variant_names[(cache.attr_inc(KEY_NAME) - 1) % variant_names.size]
end