Custom JID option is not recognized when provided as string
Closed this issue · 2 comments
younker commented
[4] pry(#<Jobs::Enqueue>)> queue.put(actor, {}, {:depends=>:silo_retrieve_valid_engines, :priority=>100, :jid=>:silo_retrieve_valid_engine_locales})
JSON::GeneratorError: only generation of JSON objects or arrays allowed from /Users/younker/.rvm/gems/ruby-2.1.6@barbosa/gems/json-1.8.3/lib/json/common.rb:223:in `generate'
[5] pry(#<Jobs::Enqueue>)> queue.put(actor, {}, {'depends'=>'silo_retrieve_valid_engines', :priority=>100, 'jid'=>'silo_retrieve_valid_engine_locales'})
=> "a4186b13ba1a49739ef45ecf345f55d9"
[6] pry(#<Jobs::Enqueue>)> # ^^^ Note the custom JID did not take
[7] pry(#<Jobs::Enqueue>)> queue.put(actor, {}, {'depends'=>'silo_retrieve_valid_engines', :priority=>100, :jid=>'silo_retrieve_valid_engine_locales'})
=> "silo_retrieve_valid_engine_locales"
myronmarston commented
Looking at the implementation of Queue#put
, none of the options are supported using string keys. I don't think it would make sense to support jid
using a string key but support only symbols for the rest of the options. Checking for string keys would also require extra overhead so I'm not sure it is worth adding.
Why do you need to pass the key as 'jid'
rather than :jid
?
Bear in mind that KW args (a ruby 2.0+ feature) only work with symbols, not strings. If Qless did not support 1.9 I believe we would use kw args here and we may do that someday. Supporting string keys now would cause problems if/when we ever wanted to use keyword arguments in the future.