Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for redis-client, which does not automatically cast types to strings #696

Merged
merged 2 commits into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/split/alternative.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def validate!
end

def reset
Split.redis.hmset key, "participant_count", 0, "completed_count", 0, "recorded_info", nil
Split.redis.hmset key, "participant_count", 0, "completed_count", 0, "recorded_info", nil.to_s
knarewski marked this conversation as resolved.
Show resolved Hide resolved
unless goals.empty?
goals.each do |g|
field = "completed_count:#{g}"
Expand Down
6 changes: 3 additions & 3 deletions lib/split/experiment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def save
persist_experiment_configuration
end

redis.hmset(experiment_config_key, :resettable, resettable,
redis.hmset(experiment_config_key, :resettable, resettable.to_s,
:algorithm, algorithm.to_s)
self
end
Expand Down Expand Up @@ -408,12 +408,12 @@ def cohorting_disabled?

def disable_cohorting
@cohorting_disabled = true
redis.hset(experiment_config_key, :cohorting, true)
redis.hset(experiment_config_key, :cohorting, true.to_s)
end

def enable_cohorting
@cohorting_disabled = false
redis.hset(experiment_config_key, :cohorting, false)
redis.hset(experiment_config_key, :cohorting, false.to_s)
end

protected
Expand Down
2 changes: 1 addition & 1 deletion spec/experiment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def alternative(color)
experiment_start_time = Time.parse("Sat Mar 03 14:01:03")
expect(Time).to receive(:now).twice.and_return(experiment_start_time)
experiment.save
Split.redis.hset(:experiment_start_times, experiment.name, experiment_start_time)
Split.redis.hset(:experiment_start_times, experiment.name, experiment_start_time.to_s)

expect(Split::ExperimentCatalog.find("basket_text").start_time).to eq(experiment_start_time)
end
Expand Down