lib/verdict/storage/legacy_redis_storage.rb in verdict-0.4.0 vs lib/verdict/storage/legacy_redis_storage.rb in verdict-0.4.1
- old
+ new
@@ -28,21 +28,26 @@
raise Verdict::StorageError, "Redis error: #{e.message}"
end
def remove_assignment(experiment, subject_identifier)
redis.hdel(generate_experiment_key(experiment), subject_identifier)
+ rescue ::Redis::BaseError => e
+ raise Verdict::StorageError, "Redis error: #{e.message}"
end
def retrieve_start_timestamp(experiment)
if started_at = redis.get(generate_experiment_start_timestamp_key(experiment))
DateTime.parse(started_at).to_time
end
+ rescue ::Redis::BaseError => e
+ raise Verdict::StorageError, "Redis error: #{e.message}"
end
def store_start_timestamp(experiment, timestamp)
redis.setnx(generate_experiment_start_timestamp_key(experiment), timestamp.to_s)
+ rescue ::Redis::BaseError => e
+ raise Verdict::StorageError, "Redis error: #{e.message}"
end
-
private
def generate_experiment_key(experiment)
"#{@key_prefix}#{experiment.handle}"