You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Excluded host requests still makes calls to Redis. #482
Excluded host requests still makes calls to Redis. It would be great if the ab_test method simply returned the control instead of querying for an alternative.
def ab_test(metric_descriptor, control = nil, *alternatives)
if !exclude_visitor?
begin
experiment = ExperimentCatalog.find_or_initialize(metric_descriptor, control, *alternatives)
alternative = if Split.configuration.enabled
experiment.save
trial = Trial.new(:user => ab_user, :experiment => experiment,
:override => override_alternative(experiment.name), :exclude => exclude_visitor?,
:disabled => split_generically_disabled?)
alt = trial.choose!(self)
alt ? alt.name : nil
else
control_variable(experiment.control)
end
rescue Errno::ECONNREFUSED, Redis::BaseError, SocketError => e
raise(e) unless Split.configuration.db_failover
Split.configuration.db_failover_on_db_error.call(e)
if Split.configuration.db_failover_allow_parameter_override
alternative = override_alternative(experiment.name) if override_present?(experiment.name)
alternative = control_variable(experiment.control) if split_generically_disabled?
end
ensure
alternative ||= control_variable(experiment.control)
end
else
alternative = control
end
if block_given?
metadata = trial ? trial.metadata : {}
yield(alternative, metadata)
else
alternative
end
end
Activity