You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Sidekiq Pro调用brpoplpush抛参数错误:给定3个参数但期望2个

问题:Sidekiq Pro调用brpoplpush时出现参数不匹配错误

使用Sidekiq Pro 5.5.2时,调用brpoplpush方法抛出ArgumentError,提示wrong number of arguments (given 3, expected 2)。但Redis 5.0.5的源码显示brpoplpush应接受3个参数,且Sidekiq Pro在lib/sidekiq/pro/super_fetch.rb第355行确实传入了3个参数:

result = conn.brpoplpush(queue, working_queue, config[:fetch_timeout] || 1)

当前依赖版本:

sidekiq-pro (5.5.2)
  sidekiq (>= 6.5.0)

redis (5.0.5)
  redis-client (>= 0.9.0)

原因分析

问题根源是redis-client版本不兼容:

  • 旧版redis-rb的brpoplpush支持3个位置参数:source、destination、timeout
  • 但redis-client 0.14.0及以上版本将timeout改为关键字参数,只能通过timeout:传入,不再支持位置参数传递

你的redis 5.0.5依赖redis-client >=0.9.0,如果实际安装的redis-client版本是0.14.0+,就会和Sidekiq Pro 5.5.2的位置参数调用方式冲突,触发参数不匹配错误。


解决办法

方案1:锁定兼容的redis-client版本

在Gemfile中添加以下配置,强制使用支持位置参数的旧版本:

gem "redis-client", "~> 0.13.0"

执行bundle update redis-client完成版本降级。

方案2:升级Sidekiq Pro

Sidekiq Pro 5.5.3及以上版本已修复该兼容问题,改用关键字参数调用brpoplpush,适配新版redis-client。

内容的提问来源于stack exchange,提问作者Daniel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.17 22:05:20