1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

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 HEAD
--------- ---------
- Warn if Redis is configured to evict data under memory pressure [#4752]
- Add process RSS on the Busy page [#4717] - Add process RSS on the Busy page [#4717]
6.1.2 6.1.2

View file

@ -59,12 +59,20 @@ module Sidekiq
# touch the connection pool so it is created before we # touch the connection pool so it is created before we
# fire startup and start multithreading. # 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" 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" 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 end
# Since the user can pass us a connection pool explicitly in the initializer, we # 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
end end
assert_includes @logdev.string, "'noeviction' maxmemory policy is recommended (current policy: 'allkeys-lru')" assert_includes @logdev.string, "allkeys-lru"
end end
it 'silent if the policy is noeviction' do it 'silent if the policy is noeviction' do
@ -504,7 +504,7 @@ describe Sidekiq::CLI do
end end
end end
refute_includes @logdev.string, "'noeviction' maxmemory policy is recommended" refute_includes @logdev.string, "noeviction"
end end
end end
end end