Skip to content

Commit

Permalink
Rescue from Redis::BaseError in #ab_test
Browse files Browse the repository at this point in the history
Redis defines a number of different exception classes (see
https://github.com/redis/redis-rb/blob/1bd43346cdf71ba69176612714616289a5a70ed4/lib/redis/errors.rb
for details). When Redis raises an exception, we need to be able to have
the db_failover configuration used, whether it's a failure to connect, a
timeout, or an invalid command.

We ran into this issue when our Redis instance ran out of memory. In
that case (and most others), Split should be able to handle things
gracefully.
  • Loading branch information
Nicholas Firth-McCoy committed Oct 20, 2015
1 parent de03148 commit 7406686
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/split/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def ab_test(metric_descriptor, control = nil, *alternatives)
else
control_variable(experiment.control)
end
rescue Errno::ECONNREFUSED, Redis::CannotConnectError, SocketError => e
rescue Errno::ECONNREFUSED, Redis::BaseError, SocketError => e
raise(e) unless Split.configuration.db_failover
Split.configuration.db_failover_on_db_error.call(e)

Expand Down

0 comments on commit 7406686

Please sign in to comment.