Closed nsweeting closed 6 years ago
Thanks for the bug report! Yeah this looks wrong 🤔
Looks like this comes from the cjson package used in the lua scripts:
127.0.0.1:6379> EVAL 'return cjson.encode(cjson.decode(\'{"args": []}\'))' 0
"{\"args\":{}}"
See also https://github.com/mpx/lua-cjson/issues/11#issuecomment-287617268.
Not sure what can be done. 😞
@nsweeting The only workaround I can think of at the moment is to have at least one argument for such jobs even if it's not used.
defmodule Job do
def perform(1) do
IO.inspect "hello"
end
end
job = %Verk.Job{class: Job, args: [1], queue: "default"}
Not Ideal but better than getting that error.
Maybe we could try to "patch" the JSON when decoding? We know that args
is an array. I wonder what's the best place to do this...
What about something like this - https://github.com/edgurgel/verk/pull/154?
It appears as though scheduled zero-arg jobs end up getting their
[]
arg list cast into a{}
with theLPUSH
command.Currently this results in:
And the redis console output: