Rykian / clockwork

A scheduler process to replace cron.
MIT License
544 stars 66 forks source link

Calling `configure` breaks everything #16

Open cjbottaro opened 7 years ago

cjbottaro commented 7 years ago

Hi.

This code doesn't work:

module Clockwork

  configure do |config|
    config[:sleep_timeout] = 1
    config[:logger] = Logger.new(STDOUT)
    config[:tz] = "CST"
    config[:max_threads] = 10
    config[:thread] = true
  end

  handler { |job| puts job.inspect }

  every(1.second, "frequent_hob")
end

But if you comment out the configure block, then everything runs fine.

Thanks.

jwoertink commented 6 years ago

I'm getting the same after upgrading to 2.0 (and rails 5)

NoMethodError: undefined method `configure' for Clockwork:Module

EDIT: Turns out that (at least in rails 5) if you have your clockwork file named clockwork.rb it breaks. I renamed the file to schedule.rb and it all works fine. Maybe something with how rails autoloads now?