que-rb/que

`Que::Locker.new(options)` raises `wrong number of arguments (given 1, expected 0)` in Ruby 3.0.3

bjeanes opened this issue · 3 comments

AIUI, Ruby 3 does not expand a last-arg hash to kwargs implicitly, and ** is needed here:

(rdbg) Que::Locker.new(options)    # ruby
eval error: wrong number of arguments (given 1, expected 0)
  /bundle/ruby/3.0.0/gems/que-1.0.0.beta5/lib/que/locker.rb:52:in `initialize'
  (rdbg)//bundle/ruby/3.0.0/gems/que-1.0.0.beta5/bin/command_line_interface.rb:1:in `new'
  (rdbg)//bundle/ruby/3.0.0/gems/que-1.0.0.beta5/bin/command_line_interface.rb:1:in `rescue in parse'
nil
(rdbg) options
{:worker_priorities=>[10, 30, 50, nil, nil, nil], :poll_interval=>5}
(rdbg) Que::Locker.new(**options)    # ruby
#<Que::Locker:0x0000ffffba164508
 @connection=
  #<Que::Connection:0x0000ffffb72ded28
  [... snip ...]

Does changing this to Que::Locker.new(**options) break compatibility? Otherwise I think ruby2_keywords def initialize(...) may be the way to go.


Side-note, this was really frustrating to debug because there is no stack trace shown.
image

Looks like this is a duplicate of #311, which is 6 months old now. I love que, but it seems like Ruby 3 is not yet supported, so I'll use something else for now...

Hah. You're welcome to try out our Ruby 3 PR - we're just awaiting battle-testing it in our apps before releasing it (and creating/documenting an upgrade procedure for a database that contains jobs)

Hah hey @ZimbiX! Long-time, no chat. Hope you're well :)

I would otherwise be happy to try that PR, but this is a pretty time-sensitive project that has some pretty specific constraints so I'm going to go with GoodJob on this project (I've wanted to test it out anyway). On our main project, we want to upgrade to Ruby 3 soon, so I'll give your PR a try if it's not already merged.