Redis gem 4.6.0:sidekiq 日志中的多管道命令警告

Redis gem 4.6.0: Multi pipeline commands warnings in sidekiq logs

我在 ROR 应用程序中使用 sidekiq 运行 后台作业。最近 redis gem 版本更新到 4.6.0(自动作为 sidekiq 依赖项),但它会产生一些多管道命令不断警告,因为 sidekiq 日志充斥着这些日志并且很难跟踪 Worker 日志。请告诉我如何删除这些警告?

Sidekiq 日志:

(called from /Users/username/.rvm/gems/ruby-2.7.0/gems/sidekiq-6.4.0/lib/sidekiq/launcher.rb:141:in `block in ❤'}
Pipelining commands on a Redis instance is deprecated and will be removed in Redis 5.0.0.

redis.multi do
  redis.get("key")
end

should be replaced by

redis.multi do |pipeline|
  pipeline.get("key")
end

原因如下:

That’s from the Redis gem. 6.4.1 will be released Monday and fix it. Downgrade that gem or use Sidekiq’s main branch if you want an immediate fix.

https://github.com/mperham/sidekiq/issues/5178#issuecomment-1029545859

我遇到了同样的问题。 onerinas 的回答是正确的。为简单起见,下面是升级 sidekiq gem 所需的代码。这解决了我的问题。

gem 'sidekiq', '>= 6.4.1'

https://github.com/mperham/sidekiq/issues/5169#issuecomment-1029171282