Ruby 3: Que logger unable to log errors generated within a worker
AlanLattimore opened this issue · 2 comments
AlanLattimore commented
How the system behaves:
When an exception is generated within a worker, Que generates its own error while trying to log the error. Que's exception overwrites and obscures the original error.
in que-jobs
, last_error_message
:
ArgumentError: wrong number of arguments (given 1, expected 0; required keyword: event)
and
last_error_backtrace
:
/Users/alattimore/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/que-90968bac489b/lib/que/utils/logging.rb:11:in `log'
/Users/alattimore/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/que-90968bac489b/lib/que/worker.rb:121:in `work_job'
/Users/alattimore/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/que-90968bac489b/lib/que/worker.rb:69:in `work_loop'
/Users/alattimore/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/que-90968bac489b/lib/que/worker.rb:46:in `block in initialize'
Suspected cause:
Automatic conversion from a hash to keyword arguments was deprecated in ruby 2.7 and no longer supported in ruby 3.0
Que.log(log_message)
should probably be:
Que.log(**log_message)
AlanLattimore commented
Excellent! I hadn't found those.
I also wasn't sure about ruby version compatibility and under which version of ruby the double splat operator was introduced.