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

Fix deprecation warning when using redis-namespace (#5066)

We need to call the `script` command on the raw redis connection because
passthrough for administrative commands has been deprecated and will be
removed in redis-namespace 2.0

Co-authored-by: Heinrich Lee Yu <heinrich@gitlab.com>
This commit is contained in:
Heinrich Lee Yu 2021-11-24 01:13:20 +08:00 committed by GitHub
parent 837745ac9a
commit e093c1b0f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,7 +47,10 @@ module Sidekiq
private
def zpopbyscore(conn, keys: nil, argv: nil)
@lua_zpopbyscore_sha = conn.script(:load, LUA_ZPOPBYSCORE) if @lua_zpopbyscore_sha.nil?
if @lua_zpopbyscore_sha.nil?
raw_conn = conn.respond_to?(:redis) ? conn.redis : conn
@lua_zpopbyscore_sha = raw_conn.script(:load, LUA_ZPOPBYSCORE)
end
conn.evalsha(@lua_zpopbyscore_sha, keys: keys, argv: argv)
rescue Redis::CommandError => e