Skip to content

Commit

Permalink
Merge pull request #696 from knarewski/add-support-for-redis-client
Browse files Browse the repository at this point in the history
Add support for redis-client, which does not automatically cast types to strings
  • Loading branch information
andrehjr authored Sep 12, 2022
2 parents 29c6c07 + 72b9d89 commit 95795b4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
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", ""
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

0 comments on commit 95795b4

Please sign in to comment.