Created
February 5, 2019 00:16
-
-
Save patrobinson/744bb0ff8ab66f605425f43185edebc9 to your computer and use it in GitHub Desktop.
Test how long an ElastiCache Redis Failover takes before the app reconnects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'redis' | |
$redis = Redis.new({url: ENV['REDIS_HOST']}) | |
puts $redis.connected? | |
failed = false | |
starting = nil | |
ending = nil | |
loop do | |
$redis.ping | |
if failed | |
ending = Time.now | |
puts ending - starting | |
break | |
end | |
rescue => e | |
puts e | |
starting = Time.now unless failed | |
failed = true | |
retry | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'redis' | |
require 'semian/redis' | |
$redis = Redis.new({url: ENV['REDIS_HOST'], semian: { | |
name: "inventory", | |
tickets: 4, | |
success_threshold: 2, | |
error_threshold: 4, | |
error_timeout: 20 | |
}}) | |
puts $redis.connected? | |
failed = false | |
starting = nil | |
ending = nil | |
loop do | |
$redis.ping | |
if failed | |
ending = Time.now | |
puts ending - starting | |
break | |
end | |
rescue => e | |
puts e | |
starting = Time.now unless failed | |
failed = true | |
retry | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment