Warn louder

This commit is contained in:
Mike Perham 2020-12-02 09:27:14 -08:00
parent c4c01f8894
commit 4a43f598fb
3 changed files with 14 additions and 5 deletions

View File

@ -5,6 +5,7 @@
HEAD
---------
- Warn if Redis is configured to evict data under memory pressure [#4752]
- Add process RSS on the Busy page [#4717]
6.1.2

View File

@ -59,12 +59,20 @@ module Sidekiq
# touch the connection pool so it is created before we
# fire startup and start multithreading.
ver = Sidekiq.redis_info["redis_version"]
info = Sidekiq.redis_info
ver = info["redis_version"]
raise "You are connecting to Redis v#{ver}, Sidekiq requires Redis v4.0.0 or greater" if ver < "4"
maxmemory_policy = Sidekiq.redis_info["maxmemory_policy"]
maxmemory_policy = info["maxmemory_policy"]
if maxmemory_policy != "noeviction"
logger.warn "'noeviction' maxmemory policy is recommended (current policy: '#{maxmemory_policy}'). See: https://github.com/mperham/sidekiq/wiki/Using-Redis#memory"
logger.warn <<~EOM
WARNING: Your Redis instance will evict Sidekiq data under heavy load.
The 'noeviction' maxmemory policy is recommended (current policy: '#{maxmemory_policy}').
See: https://github.com/mperham/sidekiq/wiki/Using-Redis#memory
EOM
end
# Since the user can pass us a connection pool explicitly in the initializer, we

View File

@ -492,7 +492,7 @@ describe Sidekiq::CLI do
end
end
assert_includes @logdev.string, "'noeviction' maxmemory policy is recommended (current policy: 'allkeys-lru')"
assert_includes @logdev.string, "allkeys-lru"
end
it 'silent if the policy is noeviction' do
@ -504,7 +504,7 @@ describe Sidekiq::CLI do
end
end
refute_includes @logdev.string, "'noeviction' maxmemory policy is recommended"
refute_includes @logdev.string, "noeviction"
end
end
end