Error: undefined method `name' for {"cron"=>"0 1 * * *"}:Hash
toddkummer opened this issue · 2 comments
toddkummer commented
The schedule is not being parsed into an object, resulting in an error when it is read.
undefined method `name' for {"cron"=>"0 1 * * *"}:Hash
lib/ruby/gems/2.5.0/gems/que-scheduler-4.2.1/lib/que/scheduler/enqueueing_calculator.rb:19:in `block in parse'
lib/ruby/gems/2.5.0/gems/que-scheduler-4.2.1/lib/que/scheduler/enqueueing_calculator.rb:18:in `map'
lib/ruby/gems/2.5.0/gems/que-scheduler-4.2.1/lib/que/scheduler/enqueueing_calculator.rb:18:in `parse'
lib/ruby/gems/2.5.0/gems/que-scheduler-4.2.1/lib/que/scheduler/scheduler_job.rb:28:in `block in run'
lib/ruby/gems/2.5.0/gems/que-scheduler-4.2.1/lib/que/scheduler/db.rb:23:in `block in transaction'
The following monkey patch seems to resolve the issue:
module Que
module Scheduler
class Schedule
class << self
def from_hash(config_hash)
config_hash.map do |name, defined_job_hash|
name_str = name.to_s
[name_str, hash_item_to_defined_job(name_str, defined_job_hash)]
end.to_h
end
end
end
end
end
The map
was removed (replaced with to_h
) in this commit:
hlascelles/que-scheduler@6d2f950#diff-816c18226c519ce6a91c9f9fd70f20b7e2a5d891345369cf0dc3c99279744f23L39-R39
ZimbiX commented
I don't have any experience with que-scheduler, but it sounds like the issue is with that rather than Que itself? I'd suggest you open an issue there instead
toddkummer commented
Yes, I posted to the wrong gem. Sorry about that.