plashchynski / crono

A time-based background job scheduler daemon (just like Cron) for Rails
https://github.com/plashchynski/crono
Apache License 2.0
687 stars 56 forks source link

Parameters Error #95

Closed hiveer closed 2 years ago

hiveer commented 2 years ago
$ bundle exec crono RAILS_ENV=development
wrong number of arguments (given 2, expected 1)
/Users/hiveerli/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/crono-1.1.2/lib/crono/period.rb:7:in `initialize'
/Users/hiveerli/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/crono-1.1.2/lib/crono/performer_proxy.rb:11:in `new'
/Users/hiveerli/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/crono-1.1.2/lib/crono/performer_proxy.rb:11:in `every'
/Users/hiveerli/works/jihu-partner-portal/config/cronotab.rb:15:in `<main>'
/Users/hiveerli/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Users/hiveerli/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'

My configuration is like this:

Crono.perform(OppReportWeeklyJob).every 1.week, on: :tuesday, at: "8:30"
plashchynski commented 2 years ago

Hello @hiveer, could you please check it with a new version of the gem (2.0.0) and report back if the problem is still persist. Thank you!

anko20094 commented 2 years ago

For:

class TestJob
  def perform
    puts 'Test!'
  end
end

Crono.perform(TestJob).every 5.seconds

I have error:

I, [2022-06-15T13:48:24.697900 #56713]  INFO -- : Perform TestJob
E, [2022-06-15T13:48:24.698774 #56713] ERROR -- : Finished TestJob in 0.00 seconds with error: wrong number of arguments (given 1, expected 0)
E, [2022-06-15T13:48:24.698811 #56713] ERROR -- : /home/danyil/Desktop/telegram_bot_app/config/cronotab.rb:9:in `perform'
plashchynski commented 2 years ago

Hello @anko20094 thank you for the reporting. It should be fixed in the master.