mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
return obvious fake info when INFO is disabled
This commit is contained in:
parent
23c1c6bcde
commit
b787ed2b12
2 changed files with 20 additions and 7 deletions
|
@ -37,6 +37,14 @@ module Sidekiq
|
|||
'queue' => 'default'
|
||||
}
|
||||
|
||||
FAKE_INFO = {
|
||||
"redis_version" => "9.9.9",
|
||||
"uptime_in_days" => "9999",
|
||||
"connected_clients" => "9999",
|
||||
"used_memory_human" => "9P",
|
||||
"used_memory_peak_human" => "9P"
|
||||
}.freeze
|
||||
|
||||
def self.❨╯°□°❩╯︵┻━┻
|
||||
puts "Calm down, yo."
|
||||
end
|
||||
|
@ -92,12 +100,18 @@ module Sidekiq
|
|||
|
||||
def self.redis_info
|
||||
redis do |conn|
|
||||
# admin commands can't go through redis-namespace starting
|
||||
# in redis-namespace 2.0
|
||||
if conn.respond_to?(:namespace)
|
||||
conn.redis.info
|
||||
else
|
||||
conn.info
|
||||
begin
|
||||
# admin commands can't go through redis-namespace starting
|
||||
# in redis-namespace 2.0
|
||||
if conn.respond_to?(:namespace)
|
||||
conn.redis.info
|
||||
else
|
||||
conn.info
|
||||
end
|
||||
rescue Redis::CommandError => ex
|
||||
#2850 return fake version when INFO command has (probably) been renamed
|
||||
raise unless ex.message =~ /unknown command/
|
||||
FAKE_INFO
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -101,7 +101,6 @@ class TestSidekiq < Sidekiq::Test
|
|||
it 'calls the INFO command which returns at least redis_version' do
|
||||
output = Sidekiq.redis_info
|
||||
assert_includes output.keys, "redis_version"
|
||||
assert_includes output.keys, "uptime_in_days"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue