Class: Gitlab::Experiment::Rollout::RoundRobin
- Defined in:
- lib/gitlab/experiment/rollout/round_robin.rb
Constant Summary collapse
- KEY_NAME =
:last_round_robin_variant
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#execute ⇒ Object
Requires a cache to be configured.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Gitlab::Experiment::Rollout::Base
Instance Method Details
#execute ⇒ Object
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.
17 18 19 |
# File 'lib/gitlab/experiment/rollout/round_robin.rb', line 17 def execute variant_names[(cache.attr_inc(KEY_NAME) - 1) % variant_names.size] end |