resque-scheduler icon indicating copy to clipboard operation
resque-scheduler copied to clipboard

resque-scheduler (4.3.1) bug with rufus-scheduler (3.5.0)

Open Nkadze opened this issue 7 years ago • 7 comments

Hi, This happens when it tries to start schedule from scheduler file,

NoMethodError: undefined method `next_time' for nil:NilClass
/app/vendor/bundle/ruby/2.3.0/gems/rufus-scheduler-3.5.0/lib/rufus/scheduler/jobs.rb:640:in `next_time_from'

cron type:

my_job_name:
  cron:  '/15 * * * *' # every 15 minutes
  queue: queue_name
  class: ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper
  args:
    job_class: JobClassName
    queue_name: queue_name
  description: "This job runs every 15 minutes"

when I locked rufus-scheduler '~> 3.4.2' in gemfile, it was solved

Thanks, Niko

Nkadze avatar Jul 19 '18 11:07 Nkadze

Same for us, ::Fugit::Cron.parse(cronline) in rufus-scheduler 3.5.0 is unable to parse cronline with timezone, like 0 0 * * 1 Etc/GMT-12. Look like a big change in behavior compare to CronLine.new(cronline) in rufus-scheduler 3.4.0

anvox avatar Aug 02 '18 17:08 anvox

Related has anyone confirmed if * * * * * or * * * * * * works as a job never being scheduled? Our jobs which were to never get scheduled were firing every second. Just rolled back and will investigate more later.

jweir avatar Aug 11 '18 02:08 jweir

Has anyone figured this out?

tmedford avatar Mar 12 '19 17:03 tmedford

still seems to be an issue, I've just bumped into this with rufus-scheduler 3.5.2

mcphailtom avatar Apr 15 '19 21:04 mcphailtom

Sounds like that should've been a rufus-scheduler 4.0.0 release. As a workaround, resque-scheduler 4.4.1 could require rufus-scheduler ~> 3.2, < 3.5 and resque-scheduler 5.0.0 would use rufus-scheduler ~> 3.5.

But that may break those who've already upgraded to rufus-scheduler 3.5+ and changed their cron lines…

jeremy avatar Apr 15 '19 22:04 jeremy

Regarding the specific cases above, it appears the parser just got stricter. But the exception is misleading.

'/15 * * * *' # every 15 minutes

Nonstandard syntax. Should be */15 * * * *

* * * * * or * * * * * * works as a job never being scheduled?

That doesn't work. It means run every minute

Think you'll need to omit the schedule rather than using cron syntax to not run it.

jeremy avatar Apr 15 '19 22:04 jeremy

Released fugit 1.2.0. It accepts the non-standard "/15 * * * *".

Released rufus-scheduler 3.6.0 which fails on invalid cron strings, with a better error message.

Fugit is the parsing library used by rufus-scheduler.

jmettraux avatar Apr 21 '19 22:04 jmettraux